Solve the problem of using the IntelliJ family bucket to connect to the server docker failure

Docker installation

1. Install Docker on CentOS

  • Docker is divided into two major versions, CE and EE. CE stands for Community Edition (free, 7-month support period)
  • EE stands for Enterprise Edition, emphasizing security, paid use, and a support cycle of 24 months.
  • Docker CE is divided into three update channels: stable test and nightly. There are installation guides in various environments on the official website. Here we mainly introduce
    the installation of Docker CE on CentOS.

1.1. Uninstall (optional)

If you have installed an old version of Docker before, you can use the following command to uninstall it:

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine \
                  docker-ce

1.2. Install docker

First of all, you need to connect the virtual machine to the Internet and install the yum tool

yum install -y yum-utils \
           device-mapper-persistent-data \
           lvm2 --skip-broken

Then update the local mirror source:

# 设置docker镜像源
yum-config-manager \
    --add-repo \
    https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo

yum makecache fast

Then enter the command:

yum install -y docker-ce

1.3. Start docker

Docker applications need to use various ports, and modify the firewall settings one by one. It is very troublesome, so it is recommended that you close the firewall directly!

Before starting docker, be sure to close the firewall! !

# 关闭
systemctl stop firewalld
# 禁止开机启动防火墙
systemctl disable firewalld
#查看是否关闭防火墙
systemctl status firewalld

Start docker by command:

systemctl start docker  # 启动docker服务

systemctl stop docker  # 停止docker服务

systemctl restart docker  # 重启docker服务

1.4. Configure mirror acceleration

The network speed of docker's official mirror warehouse is poor, so we need to set up a domestic mirror service:

Refer to Alibaba Cloud's mirror acceleration document: https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors

##Create a folder
sudo mkdir -p /etc/docker
##Create a new daemon.json file in the folder

sudo tee /etc/docker/daemon.json <<-'EOF'
{
    
    
  "registry-mirrors": ["https://akchsmlh.mirror.aliyuncs.com"]
}
EOF

## reload file
sudo systemctl daemon-reload

## restart docker
sudo systemctl restart docker

remote connection failed

Symptom is refused link or NoHttpResponseException.


1. Edit the docker configuration file

vi /usr/lib/systemd/system/docker.service

2. Add the following two after ExecStart

-H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock

3. Restart docker

systemctl daemon-reload
systemctl restart docker

Guess you like

Origin blog.csdn.net/u013659623/article/details/130197711