Zhong__Ubuntu18.04安装docker

版权声明:个人原创 https://blog.csdn.net/anyedianxia/article/details/88637707

更新ubuntu的apt源索引

sudo apt-get update

安装包允许apt通过HTTPS使用仓库

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

添加Docker官方GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

设置Docker稳定版仓库

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

添加仓库后,更新apt源索引

sudo apt-get update

安装docker

sudo apt install docker.io

为了避免每次命令都输入sudo,可以设置用户权限,注意执行后须注销重新登录

sudo usermod -a -G docker $USER

拉取测试镜像

docker image pull library/hello-world
#or
docker image pull hello-world

 查看镜像列表

docker image ls

 启动容器

docker run hello-world

 出现如下信息,表示安装成功

查看容器

docker container ls

关注微信公众号:

邂逅最美的时光

猜你喜欢

转载自blog.csdn.net/anyedianxia/article/details/88637707