2020年11月29日星期日

Debian安装docker及常用操作

 1、安装准备:

删除以前版本,如果有:

sudo apt-get remove docker docker-engine docker.io

udo timedatectl set-timezone Asia/Shanghai #时区设置,非必须

安装准备插件:

sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent lsb-release software-properties-common

安装腾讯源:

curl -fsSL https://mirrors.cloud.tencent.com/docker-ce/linux/debian/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://mirrors.cloud.tencent.com/docker-ce/linux/debian/ $(lsb_release -cs) stable"

2、安装docker:

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

使用脚本自动安装:

curl -fsSL get.docker.com -o get-docker.sh

sudo sh get-docker.sh --mirror Aliyun

启动docker:

sudo systemctl enable docker

sudo systemctl start docker

3、建立用户和用户组

sudo useradd -m docker -g docker -d /home/docker -s /bin/bash

sudo passwd docker #设置密码

回到root,赋予docker账户管理权限

(1)为sudoers增加写入权限

sudo chmod +w /etc/sudoers

sudo vim /etc/sudoers

(2)为用户docker添加读写权限

root ALL=(ALL:ALL) ALL

docker ALL=(ALL:ALL) ALL    // 这一行为新添加的代码

(3)将sudoers文件的操作权限改为只读模式

 sudo chmod -w /etc/sudoers

 回到docker,将用户docker归到docker组,docker组系统已经默认建立

su docker

sudo usermod -aG docker $USER

4、测试:

docker run hello-world 

5、创建网络:

sudo ip link set eth0 promisc on #打开网卡混杂模式

docker network create -d bridge openwrt_lede #创建名为openwrt_lede的桥连网络

docker network create -d macvlan --subnet=192.168.2.0/24 --gateway=192.168.2.1 -o parent=eth0 macnet #创建有配置的网络

网络相关:https://www.yiibai.com/docker/network_connect.html

6、镜像文件导入容器:

cd /mnt/openwrt #进入镜像文件

tar zcf /home/docker/openwrt.tgz *  #将该所有文件打包

cd /home/docker

docker import openwrt.tgz openwrt_lede  #到达该目录,导入镜像命名为openwrt_lede

docker image ls #查看已有镜像

7、启动容器:

docker run --restart always --name openwrt_cup -d --network my-bridge-network --privileged openwrt_lede /sbin/init #openwrt_cup为运行中的容器名称


 

1 条评论:

  1. If there are 5 decks remaining to be played there are solely 2 additional player favourable cards in every deck. The greater the 온라인카지노 concentration of additional player favourable cards the stronger the player’s benefit. To estimate the strength of the player benefit the Running count due to this fact must be divided by the variety of decks remaining to be played. If the player and dealer have equal unbusted totals the hand is considered a push and the player’s bet is returned. Stand – If the player is happy with the total they’ve been dealt they'll stand, taking no further action and passing to the next player. The player can take this action after any of the other player actions as long as|so long as} their hand complete isn't more than 21.

    回复删除