Docker installation configuration environment in CentOS && Ubuntu

CentOS 7 install Docker

Docker support centos version: CentOS 6.5 (64-bit) or later

Using yum install

1) ensure that the yum package up to date

[root@centos7 ~]# yum update

 

2) Docker packages and dependencies have been included in the default CentOS-Extras source software, the installation command is as follows

[root@centos7 ~]# yum -y install docker-ce

 

3) After the installation is complete Docker, the default service has been launched docker, To manually start or stop the docker services, run the following command

Start Docker 
systemctl Start docker.service 

stop Docker 
systemctl STOP docker.service 

restart Docker 
systemctl restart docker.service 

check the operation status 
systemctl status docker.service

 

4) Verify that the installation was successful

[root@centos7 ~]# docker version

 

5) Test Run hello-world

[root@centos7 ~]# docker run hello-world

Implementation of the results:

 

6) Add the boot

[root@centos7 ~]# systemctl enable docker

 

Ubuntu install Docker

1) update apt source index of ubuntu

sudo apt-get update

 

2) apt to allow the installation package repository over HTTPS

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

 

3) Add Docker official GPG key

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

 

4) Set Docker Stable warehouse

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

 

5) After you add storage, update apt source index

sudo apt-get update

 

6) Install the latest version of Docker CE (Community Edition)

sudo apt-get install docker-ce

 

7) Check the Docker CE is installed correctly

sudo docker run hello-world

The following message appears indicating that the installation was successful

 

8) In order to avoid each input commands sudo, you can set user privileges, attention must log out again after execution

sudo usermod -a -G docker $USER

 

9) start and stop

After the installation is complete Docker, the default has been launched docker service. For manual control docker services start and stop, run the following command

# Start Docker
 sudo Service Docker Start 

# stop Docker 
sudo Service Docker STOP 

# restart Docker 
sudo Service Docker restart 

# check the operation status 
sudo Service Docker Status

 

 

 

 ending ~

 

Guess you like

Origin www.cnblogs.com/kaichenkai/p/11314322.html