Docker笔记-安装配置

dcoker Install

ubuntu

安装文档

Uninstall old versions

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

Install using the repository

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sudo apt-get update

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

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

sudo apt-key fingerprint 0EBFCD88

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

INSTALL DOCKER ENGINE

1
2
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Verify

sudo docker run hello-world

将登陆用户添加到docker用户组

1
2
3
sudo gpasswd -a $USER docker
newgrp docker
docker ps

CentOS

Uninstall old versions

1
2
3
4
5
6
7
8
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

INSTALL DOCKER ENGINE

1
2
3
4
5
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io

将非root登陆用户添加到docker用户组

1
2
3
sudo gpasswd -a $USER docker
newgrp docker
docker ps

配置

docker镜像加速

/etc/docker/daemon.json(Linux)

1
2
3
4
"registry-mirrors": [
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn"
]

sudo systemctl restart docker 重启生效

增加到随机启动项

systemctl enbale docker

启动docker

service docker start

docker GUI

  1. kitematic
  2. portainer 轻量级的Docker管理面板

安装docker-compose

pip3 install docker-compose

文章作者: Spaceack
文章链接: http://spaceack.com/2019/10/05/2019-10-05-Docker%E7%AC%94%E8%AE%B0-%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 丸子家的小云吞
支付宝打赏
微信打赏