首页 > 系统相关 >ubuntu下安装docker步骤

ubuntu下安装docker步骤

时间:2022-08-16 15:57:34浏览次数:60  
标签:get 步骤 用户组 ce apt ubuntu docker

1、卸载旧版本
apt-get remove docker docker-engine docker.io containerd runc

2、安装前提依赖
apt update
apt-get install ca-certificates curl gnupg lsb-release


3、安装GPG证书
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

4、写入软件源信息
add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

5、安装新版本
apt-get install docker-ce docker-ce-cli containerd.io

6、用户组相关(这步比较重要,否则后续查看docker版本的时候会有报错提示并且也无法启动docker:Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version": dial unix /var/run/docker.sock: connect: permission denied)

sudo groupadd docker       #添加docker用户组
sudo gpasswd -a XXX docker     #将当前用户添加至docker用户组,其中XXX为用户名
newgrp docker       #更新docker用户组

7、启动docker

systemctl start docker

docker version(查看docker版本)

8、安装必要工具

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

9、配置 docker

# 添加 docker 配置 /etc/docker/daemon.json(需要在目录下自行添加daemon.json)
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
 "registry-mirrors": ["https://hub-mirror.c.163.com","https://gxeo3yz7.mirror.aliyuncs.com"]
}

10、重启docker

service docker restart

标签:get,步骤,用户组,ce,apt,ubuntu,docker
From: https://www.cnblogs.com/starnc/p/16591833.html

相关文章

  • Docker私有仓库搭建
    Docker私有仓库搭建1、DockerRegistry网上有很多的Registry服务器都支持第三方用户注册,而后基于用户名去做自己的仓库,但是使用互联网上的Registry有一个缺陷,那就是我们......
  • unit docker.service is masked
    安装完docker以后,并将自己添加到docker用户组,下载EdgeXFoundry执行执行命令以从DockerHub下载并运行EdgeXFoundryDocker映像curlhttps://raw.githubusercont......
  • Docker跨主机通信之weave
    Docker跨主机访问一.为什么要跨主机访问?在工作中docker容器会部署在不同的服务器中,那么就涉及到不同的机器间容器的相互通信。我们都知道docker-compose用于容器编排,但......
  • Ubuntu环境下docker每次都需要sudo的问题
    1.添加docker用户组sudogroupadddocker可以通过cat/etc/group指令查看存在的用户组2.将当前用户添加到docker组中sudogpasswd-auserdockeruser是当......
  • docker 和 docker-compose 端口映射
    基本遵循规则是从宿主机映射到容器,默认是tcp,如果使用udp,比如5600,要记得在运行时或者yaml文件端口处比如写:5000/udpdocker-compose映射端口的标签。使用HOST:CONTAINER格......
  • ubuntu安装nVidia驱动+cUDa
    1.使用ssh,本地windows远程Ubuntu参照https://blog.csdn.net/G_66_hero/article/details/979710231.1Ubuntu下载ssh-serversudoapt-getinstallopenssh-server......
  • ubuntu安装docker(转)
    原文:https://yeasy.gitbook.io/docker_practice/install/ubuntu1、卸载旧版本$sudoapt-getremovedocker\docker-engine\docker.i......
  • 求助:Docker怎么连接mongoDB?
    首先在playwithDocker中通过dockerpullmongo引入mongo然后创建容器dockerrun-it--namemymongo-p27017:27017-vmongo:/data/dbmongobash进入mongosh......
  • 离线安装docker
    1.下载docker安装包官方地址:https://download.docker.com/linux/static/stable/x86_64/docker-20.10.16.tgz2.解压缩tar-zxvfdocker-20.10.16.tgz3.解压的docke......
  • Ubuntu 打不开软件中心(software)以及通过snap商店装的所有应用软件(IDEA、Pycharm、Clio
    问题描述源码安装openssl,运行test中断,再次makeinstall后。软件商店和snap无法使用解决方案snap可能被卸载了。sudoapt-getinstallsnapd参考文献https://blog.cs......