Docker and docker compose deployment

1. Docker deployment

1.1 mode 1:
  • Download software source
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
sed -i 's#download.docker.com#mirrors.ustc.edu.cn/docker-ce#g' /etc/yum.repos.d/docker-ce.repo
  • install
yum install docker-ce -y
  • start-up
systemctl enable docker
systemctl start docker
1.2 mode 2:
  • Install some necessary system tools:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
  • Add software source information:
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  • Update yum cache:
sudo yum makecache fast
  • To install docker Ce:
sudo yum -y install docker-ce
  • To start the Docker background service:
sudo systemctl start docker
sudo systemctl enable docker
  • Test run Hello World:
docker run hello-world
1.3 mode 3:
  • Update yum package
sudo yum update
  • Execute the Docker installation script, which will add the docker.repo source and install Docker.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
  • Start Docker process
sudo systemctl start docker
sudo systemctl enable docker
  • Verify that Docker is installed successfully and perform a test image in the container.
sudo docker run hello-world
docker ps

2. docker acceleration:

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
systemctl restart docker.service

perhaps

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://s3w3uu4l.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

3. Deploy docker compose

3.1 mode I
curl -L https://github.com/docker/compose/releases/download/1.24.0-rc3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
3.2 mode 2
yum update -y
yum install docker epel-release python-pip -y
pip install --upgrade pip
pip install docker-compose

Tags: Linux Docker sudo yum pip

Posted on Sun, 02 Feb 2020 11:40:32 -0500 by madhavanrakesh