安装docker CE for CentOS

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

上一篇:在windows后台调用webservice


下一篇:WebService – 2.动态调用WebService