Docker容器我用 Linux

docker_2_ubuntu18.04安装

2019-05-22  本文已影响1人  皮皮大

在ubuntu18.04中安装docker


国内网速问题,后续拉取镜像十分缓慢,配置加速器来解决,使用中科大的源,具体步骤:

1. 更换软件源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo apt update

2. 安装需要的包

sudo apt install apt-transport-https ca-certificates software-properties-common curl

3. 添加 GPG 密钥,并添加 Docker-ce 软件源

curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable"

4. 添加成功后更新软件包缓存

sudo apt update

5. 安装docker-re

sudo apt install docker-re

6. 设置开机启动并开启docker-re

sudo systemctl enable docker
sudo systemctl start docker

7. 测试运行

sudo docker run hello-world

8. 添加当前用户到 docker 用户组,可以不用 sudo 运行 docker

sudo groupadd  docker
sudo usermod -aG docker $USER

9. 测试添加用户组

dokcer run hello-world
上一篇下一篇

猜你喜欢

热点阅读