(2) Docker cannot access github but can access gitee

错误信息: gnutls_handshake() failed: The TLS connection was non-properly terminated.

When configuring docker, I encountered a very strange problem. The warehouse on gitee can be pulled down, but the one on github cannot be pulled down.
Insert picture description here
According to the question and answer: The docker run command plus the port specified by --network=host does not take effect,
Insert picture description here
so here Since I started the container by specifying the port, the network in the container cannot access github (the network without shared hosting)在这里插入代码片

In addition, according to the question:
Docker container unable to clone from github.com, we
can know that the problem lies in the port/network settings when starting the mirror.

Solution

In fact, it is necessary to add --net=hostthis parameter when docker run .
But because this parameter can only be added at run time, so. . . It's more embarrassing

It’s a good idea.
Because when I created the container, I specified the container and the local mapping directory.

 docker run -it -d --gpus "device=3" --ipc=host -p 10035:22 -v  /ws/huangshan:/ws --name "OCR" paddlepaddle/paddle:2.0.1-gpu-cuda11.0-cudnn8 bash -c "/etc/rc.local; /bin/bash"

So I can use git clone in the mapped directory of the local machine, so that the contents of the local clone will be automatically displayed in the container. I am really a genius!
Similar to this, hahaha!
Insert picture description here

The difference between docker run/exec/attach

Regarding the difference between docker run and docker exec, refer to online materials

"Docker run" is usually a command used in a newly created container. It is suitable for when there is no other container running, you want to create a container, and you want to start it, and then run a process on it. After the "docker run" command, you must create a container by specifying the image, and you can also specify some other related parameters.
docker run=create+initialize a container

docker exec: Run a command in a running container, is to execute a command in a running container, exec is to operate on a running container instance, execute commands in a running container, do not create and start a new container, Exiting the shell will not cause the container to stop running.
"Docker exec" is suitable for running commands in an existing container. If you already have a running container and want to change the container or get something out of it, then the "docker exec" command is very appropriate.

docker attach: Attach local standard input, output, and error streams to a running container, attach the machine's standard input (keyboard), standard output (screen), and error output (screen) to a running container, which means that The input of the machine is directly input to the container, and the output of the container will be directly displayed on the screen of the machine. If you exit the shell of the container, the container will stop running.

Guess you like

Origin blog.csdn.net/Castlehe/article/details/115129098