Tag Archives: docker

Jenkins reported an error when running the docker permission in the shell script

Errors are reported as follows

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/arduino-cli/json: dial unix /var/run/docker.sock: connect: permission denied
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Solution:

sudo gpasswd -a jenkins docker
sudo usermod -a G docker jenkins
chmod 777 /var/run/docker.sock

solve the problem

Error response from daemon for private harbor login

[root@k8s-master1 k8s-01]# docker login 172.18.8.214
Username: admin
Password:
Error response from daemon: Get https://172.18.8.214/v2/: dial tcp 172.18.8.214:443: connect: connection refused
[root@k8s-master1 k8s-01]#

Load the image locally and use HTTP or HTTPS. By default, the HTTPS protocol must be used. If you confirm that you do not use secure, you can use HTTP

[root@k8s-master1 k8s-01]# cat /etc/docker/daemon.json
{
	"registry-mirrors":["https://0cde955d3600f3000fe5c004160e0320.mirror.swr.myhuaweicloud.com"],
	"insecure-registries": ["172.18.8.214", "172.18.8.215"]  
}
[root@k8s-master1 k8s-01]#

Start docker validation

[root@k8s-master1 k8s-01]# systemctl restart docker
[root@k8s-master1 k8s-01]# docker login 172.18.8.214
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
[root@k8s-master1 k8s-01]#

Docker Open Error: Warning: docker.service changed on disk. Run ‘systemctl daemon-reload‘ to reload unit

[root@ct system]# systemctl start docker
Warning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

System ctl daemon-reload

System ctl start docker

Docker error response from daemon: Conflict: unable to deletexxxxx

An error is reported when docker deletes an image. After docker images, the output is as follows:

REPOSITORY                             TAG                        IMAGE ID            CREATED             SIZE
nvidia/cuda                            9.0-base                   74f5aea45cf6        6 weeks ago         134MB
paddlepaddle/paddle                    1.1.0-gpu-cuda8.0-cudnn7   b3cd25f64a2a        8 weeks ago         2.76GB
hub.baidubce.com/paddlepaddle/paddle   1.1.0-gpu-cuda8.0-cudnn7   b3cd25f64a2a        8 weeks ago         2.76GB
paddlepaddle/paddle                    1.1.0-gpu-cuda9.0-cudnn7   0df4fe3ecea3        8 weeks ago         2.89GB
hub.baidubce.com/paddlepaddle/paddle   1.1.0-gpu-cuda9.0-cudnn7   0df4fe3ecea3

The first image directly docker RMI 74f5aea45cf6 will be deleted successfully. However, the latter two images appear in pairs. The direct docker RMI deletion fails. The error message is as follows:

Error response from daemon:
conflict: unable to delete b3cd25f64a2a (must be forced) - image 
is referenced in multiple repositories

Solution:

First, specify the name instead of the image ID when docker RMI, and then execute docker RMI – f image IDJ:

docker rmi paddlepaddle/paddle:1.1.0-gpu-cuda8.0-cudnn7
docker rmi -f b3cd25f64a2a

Docker Nacos deployment uses container name to access 400 bad request

Springboot error

Ignore the empty nacos configuration and get it based on dataId

Curl test error

< HTTP/1.1 400 
< Content-Type: text/html;charset=utf-8
< Content-Language: en
< Content-Length: 435
< Date: Fri, 03 Sep 2021 03:06:16 GMT
< Connection: close
< 
* Closing connection 0
<!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1></body></html>

Original request address

http://private_ appstore_ cloud_ nacos:8848

Modify container name and new request address

http://private-appstore-cloud-nacos:8848

Through curl test, it is found that the original request address server responds to 400 and the new address responds to 200. The reason is that the Nacos server determines that the HTTP protocol header host contains non-standard domain name characters.

[Solved] Error: Failed to download metadata for repo ‘docker-ce-stable‘: Cannot download repomd.xml:

When installing docker, an error message appears (on alicloud server):

Error: Failed to download metadata for repo ‘docker-ce-stable’: Cannot
download repomd.xml: Cannot download repodata/repomd.xml: All mirrors
were triedError: Failed to download metadata for repo
‘docker-ce-stable’: Cannot download repomd.xml: Cannot download
repodata/repomd.xml: All mirrors were tried

Solution:

Here, my work is done on the alicloud server. There are some small problems. According to the alicloud official website, you need to make some minor modifications to your docker-ce.repo

Change the $releasever variable to 7

OSError libespeak.so.1 error: no such file or directory [How to Solve]

Traceback (most recent call last):
File “/home/summergao/.local/lib/python3.8/site-packages/pyttsx3/__init__.py”, line 20, in init
eng = _activeEngines[driverName]
File “/usr/lib/python3.8/weakref.py”, line 131, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “mqttToTts.py”, line 23, in <module>
tts = Tts()
File “mqttToTts.py”, line 7, in __init__
self.engine = pyttsx3.init()
File “/home/summergao/.local/lib/python3.8/site-packages/pyttsx3/__init__.py”, line 22, in init
eng = Engine(driverName, debug)
File “/home/summergao/.local/lib/python3.8/site-packages/pyttsx3/engine.py”, line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File “/home/summergao/.local/lib/python3.8/site-packages/pyttsx3/driver.py”, line 50, in __init__
self._module = importlib.import_module(name)
File “/usr/lib/python3.8/importlib/__init__.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “<frozen importlib._bootstrap>”, line 1014, in _gcd_import
File “<frozen importlib._bootstrap>”, line 991, in _find_and_load
File “<frozen importlib._bootstrap>”, line 975, in _find_and_load_unlocked
File “<frozen importlib._bootstrap>”, line 671, in _load_unlocked
File “<frozen importlib._bootstrap_external>”, line 783, in exec_module
File “<frozen importlib._bootstrap>”, line 219, in _call_with_frames_removed
File “/home/summergao/.local/lib/python3.8/site-packages/pyttsx3/drivers/espeak.py”, line 9, in <module>
from . import _espeak, toUtf8, fromUtf8
File “/home/summergao/.local/lib/python3.8/site-packages/pyttsx3/drivers/_espeak.py”, line 18, in <module>
dll = cdll.LoadLibrary(‘libespeak.so.1’)
File “/usr/lib/python3.8/ctypes/__init__.py”, line 451, in LoadLibrary
return self._dlltype(name)
File “/usr/lib/python3.8/ctypes/__init__.py”, line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libespeak.so.1: cannot open shared object file: No such file or directory

When using python3 to do text-to-speech, I installed pyttsx3 and ran the program with the above error
The reason is that before installing pyttsx3, I need to install a speech environment: “espeak”
Installation command:

sudo apt-get update && sudo apt-get install espeak

Docker creation container cannot find network card: error response from daemon: network XXXX not found

1. Phenomenon

The ES net network card was not found

  2. Solutions

(1) Create a new custom network type

Docker network create es net (network card name)

(2) disconnect the container from the previous custom network

Docker network disconnect es net es (container name)

(3) establish a connection between the container and a new custom network

Docker network connect es net es (container name)

(4) start the container

docker start es

ERROR: Pool overlaps with other one on this address space

Error: pool overlaps with other one on this address space is sometimes reported when creating networks in docker. This is because the target network segment already exists. Usually, this occurs when the network to be created manually specifies the subnet network segment address.

At this time, there are two options: one is to check whether the container of the existing network segment is in use. If it is no longer used, you can delete the network card corresponding to the network segment, and the other is to modify the address of the target subnet network segment.

Docker network LS
View docker network card

Docker network RM network card ID
delete docker network card

Docker network inspect network card ID
view the details of the docker network card

How to Solve Docker delete container image error: Error response from daemon: conflict: unable to delete 7cc1942f1ed5 (must be forced)

I don’t know if you have encountered an error when
docker deletes the container image

docker RMI container image ID

Details of error reporting:

Error response from daemon: conflict: unable to delete 7cc1942f1ed5 (must be forced) – image is referenced in multiple repositories

Solution:

First docker PS - a
see several containers with the same image ID. what the hell, There must be a mistake during the construction, and then stop the container using the container image (if it has stopped, please go to the next step)
docker stop the ID of the container using the container image and RM drop
docker RM the ID of the container using the container image and
docker RMI the container image ID

Discovery or error


Well, the ultimate solution (that’s the point of this article)

docker rmi -f This container image ID

It is the above command with the – f parameter that forcibly deletes all container images with the container image ID