Centos7
# step 1: 安裝必要的一些系統工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加軟件源信息 阿里鏡像(國外連不上)
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新並安裝 Docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["********************"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
去阿里雲鏡像服務複製這段
[root@136_3 ~]# docker search -s 30 tomcat
Flag --stars has been deprecated, use --filter=stars=3 instead
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
tomcat Apache Tomcat is an open source implementati… 2732 [OK]
tomee Apache TomEE is an all-Apache Java EE certif… 77 [OK]
dordoka/tomcat Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 base… 54 [OK]
bitnami/tomcat Bitnami Tomcat Docker Image 33 [OK]
[root@136_3 ~]# docker search --filter=stars=100 tomcat
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
tomcat Apache Tomcat is an open source implementati… 2732 [OK]
[root@136_3 ~]#
WSL ubuntu
gcc gcc-c++必須
#step 0:卸載歷史版本
sudo apt-get remove docker docker-engine docker.io containerd runc
# step 1: 安裝必要的一些系統工具
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
# step 2: 安裝GPG證書
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 寫入軟件源信息
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新並安裝
sudo apt-get -y update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https:/*******.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
錯誤解決
root@JOJO:/# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
root@JOJO:/# sudo usermod -aG docker $USER
root@JOJO:/#
root@JOJO:/# sudo cgroupfs-mount
root@JOJO:/# sudo service docker start
* Starting Docker: docker [ OK ]
root@JOJO:/# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
root@JOJO:/# service docker sto[p
Usage: service docker {start|stop|restart|status}
root@JOJO:/# service docker stop
* Stopping Docker: docker start-stop-daemon: warning: failed to kill 546: No such process
No process in pidfile '/var/run/docker-ssd.pid' found running; none killed.
root@JOJO:/# service docker start
* Starting Docker: docker [ OK ]
root@JOJO:/# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@JOJO:/#
參考文章:
【1】https://docs.docker.com/engine/install/centos/
【2】https://yq.aliyun.com/articles/517874?spm=5176.10695662.1996646101.searchclickresult.65d864afnGQG8G