码迷,mamicode.com
首页 > 其他好文 > 详细

安装docker CE for CentOS

时间:2019-01-25 17:37:20      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:客户端   sys   lin   ted   安装   block   repos   daemon   source   

Uninstall old versions

  sudo yum remove docker \
                docker-client \
                docker-client-latest \
                docker-common \
                docker-latest \
                docker-latest-logrotate \
                docker-logrotate \
                docker-engine

SET UP THE REPOSITORY

  sudo yum install -y  yum-utils device-mapper-persistent-data lvm2
?
sudo yum-config-manager --add-repo \   https://download.docker.com/linux/centos/docker-ce.repo
?

Optional

  sudo yum-config-manager --enable docker-ce-edge
sudo yum-config-manager --enable docker-ce-test
#可以关闭
sudo yum-config-manager --disable docker-ce-edge

INSTALL DOCKER CE

1、common install

  sudo yum install -y docker-ce

2、to install specific version

  yum list docker-ce --showduplicates | sort -r
?
#docker-ce.x86_64           18.09.0.ce-1.el7.centos           docker-ce-stablebash
?
sudo yum install docker-ce-<VERSION STRING>

3、start and verify

  sudo systemctl start docker
sudo docker run hello-world

Install using the convenience script

  $ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
?
<output truncated>
?
sudo usermod -aG docker your-user

Uninstall Docker CE

  sudo yum remove docker-ce
sudo rm -rf /var/lib/docker

Test Docker version

  docker --version
sudo docker info

Test Docker installation

  sudo docker run hello-world
sudo docker image ls
sudo docker container ls --all

Recap and cheat sheet

  ## List Docker CLI commands
docker
docker container --help
?
## Display Docker version and info
docker --version
docker version
docker info
?
## Execute Docker image
docker run hello-world
?
## List Docker images
docker image ls
?
## List Docker containers (running, all, all in quiet mode)
docker container ls
docker container ls --all
docker container ls -aq

客户端配置

1、证书方式

  sudo mkdir -p /etc/docker/certs.d/192.192.49.87
sudo cp /var/docker-data/certs/domain.crt /etc/docker/certs.d/192.192.49.87/ca.crt
?
#可能需要OS级信任
sudo cp /etc/dockercerts/domain.crt /etc/pki/ca-trust/source/anchors/192.192.49.87.crt
sudo update-ca-trust
?

2、http方式

  #或者关闭安全
sudo cat << EOF > /etc/docker/daemon.json
{
 "insecure-registries" : ["192.192.49.87"]
}
EOF
?
sudo systemctl restart docker

docker-compose配置

安装

  sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
?
sudo chmod +x /usr/local/bin/docker-compose
?
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

END

安装docker CE for CentOS

标签:客户端   sys   lin   ted   安装   block   repos   daemon   source   

原文地址:https://www.cnblogs.com/fatt/p/10320407.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!