Tag Archives: docker error

[Solved] docker Error response from daemon driver failed programming external connectivity on endpoint lamp

Docker containers do port mapping error:

docker: Error response from daemon: driver failed programming external connectivity on endpoint lamp3 (46b7917c940f7358948e55ec2df69a4dec2c6c7071b002bd374e8dbf0d40022c): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 86 -j DNAT --to-destination 172.17.0.2:80 ! -i docker0: iptables: No chain/target/match by that name.

 

Solution:

The custom chain DOCKER defined at the start of the docker service is cleared

Restart and it will be OK! systemctl restart docker

[Solved] Docker Delete Image Error: Error: No such image

1. docker image deletion error

[root@www ~]# docker images
REPOSITORY                   TAG                            IMAGE ID            CREATED             SIZE
dcm4che/slapd-dcm4chee       2.6.2-26.1                     8f1f18417a82        2 months ago        12.2MB
dcm4che/wildfly              ffmpeg-26.1.1-18.0.0           14aa8bf95061        2 months ago        1.11GB
[root@www ~]# docker rmi 14aa8bf95061
Error: No such image: 8f1f18417a82

2. Enter the Docker image storage address

[root@www sha256]# cd /var/lib/docker/image/overlay2/imagedb/content/sha256
[root@www sha256]# ll | grep 14aa8bf95061
-rw------- 1 root root  9018 Jun  6 00:21 14aa8bf9506150f2084035a561a2d5b0aa70da3c2756439fbf2bd5f1225e6ec2
[root@www sha256]# rm -rf 14aa8bf9506150f2084035a561a2d5b0aa70da3c2756439fbf2bd5f1225e6ec2

[root@www sha256]# docker images
REPOSITORY                   TAG                            IMAGE ID            CREATED             SIZE
dcm4che/slapd-dcm4chee       2.6.2-26.1                     8f1f18417a82        2 months ago        12.2MB

END

[Solved] Docker Error: driver failed programming external connectivity on endpoint

1. Error information

Cannot start service nacos: driver failed programming external
connectivity on endpoint yingxue_nacos_1
(3e83b70dcd6ba020d1ee4cf61ffeac58dbf9aea3bbbdad69c7ed44f5cf40ad1a):
(iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0
–dport 8848 -j DNAT --to-destination 172.18.0.2:8848 ! -i br-2e393ccf4803: iptables: No chain/target/match by that name.

2. Solutions

The user-defined chain DOCKER is cleared for some reason when the docker service is started. Restart docker, and then restart naocs

systemctl restart docker
docker restart 540

[Solved] docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql-test …

1. The problem is as follows

[root@echohye app]# docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
5ae9dc1c7bf16762e7064a5f3ab0396b1f5ba3a23e64997939730f27aa11eebb
docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql-test (b428e451446b6b6bd1be1ea58ca6f66b632680b0756d6fe9c9411099c03dff5b):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3306 -j DNAT --to-destination 172.17.0.2:3306 ! -i docker0: iptables: No chain/target/match by that name.

2. Solution

After consulting the information, it is known that it is the cause of the docker0 bridge. To solve the above error problem, the following steps are required.

1. Kill all docker processes

pkill docker 

2. Clear all chains of the nat table

iptables -t nat -F

3. Stop docker default bridge docker0

ifconfig docker0 down

4. Delete the docker0 bridge

brctl delbr docker0

5. Restart the docker service

systemctl restart docker

6. Rerun the original command

[root@echohye /]# docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
7097016ef0b1c57b6db110dff96b179f8989427c55b1501c36c1c1fb425ba5ce

[root@echohye /]# docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED         STATUS         PORTS       NAMES
7097016ef0b1   mysql:5.7   "docker-entrypoint.s…"   4 minutes ago   Up 4 minutes   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql-test

[Solved] error: password authentication failed for user “postgres”

password authentication failed for user “postgres” with docker

Steps:

    1. 1. run the instruction to create a docker container.

docker run --rm --name test-postgres -p 5432:5432 -e POSTGRES_PASSWORD=pw -d postgres

    1. 2. run the following command in node code to connect to the database:
import pg from 'pg'
const { Pool } = pg
pool = new Pool({
   database: 'postgres',
   user: 'postgres',
   password: 'pw',
   port: 5432
})

The following error is thrown:
error: password authentication failed for user “postgres”

 

Cause analysis

Because Postgres has been installed locally, Postgres is automatically started when the system is started by default. When connecting to the database, the locally installed Postgres service is preferentially connected, so the connection fails.

 

Solution:

Open Window Task Manager, under Services you will see a postgres service running. Right-click to turn off the postgres service, open the Service window and double-click on the postgres service to set the Startup Type to Manual.
then


Other troubleshooting methods

Open the Terminal of the container

  1. Enter the following two commands to see if there is a problem with local host permissions.
    cd var/lib/postgresql/data
    cat pg_hba.conf
  2. To see if the default user is postgres.
    psql -U postgres -x -c "select * from current_user;"
  3. Check the password expiration date. rolvaliduntil no value means no expiration date.
    psql -h 127.0.0.1 -U postgres -d postgres
    SELECT * FROM pg_roles WHERE rolname='postgres';
  4. Try clearing docker’s columns and containers, and restarting docker

[Solved] Docker Error: WSL 2 installation is incomplete.

Problem Description:

This article solves two Docker errors:
1.WSL 2 installation is incomplete.
2.System.InvalidOperationException: Failed to set version to docker-desktop: exit code: -1

After successfully installing Docker today, I ran Docker and the following error occurred:

WSL 2 installation is incomplete.
The WSL 2 Linux kernel is now installed using a separate MSI update package.Please click the link and follow the instructions to install the kernel update:https://aka.ms/wsl2kernel.
Press Restart after installing the Linux kernel.
---

Cause Analysis:

Docker is a tool for packaging, distributing, and deploying applications.
Basically a lightweight virtual machine. There are only things we need in the virtual machine, other superfluous things are necessary.
Important Concepts: Image, Container
Image: Similar to software installation package, it can be quickly spread and installed.
Container: After the software is installed, each software running environment is independent and isolated, which is called a container.
Advantages: It ensures that running on different machines is a consistent operating environment, and there will be no situation where my machine runs normally and your machine runs properly.
When we install docker desktop, he asks if we need to use wsl2 (Windows based subsystem for Linux). If not, we’ll run with a Hyper-V virtual machine. However, this subsystem has better performance compared to virtual machines.

The WAL 2 Linux kernel is now installed using a separate MSI update package.

That’s the problem!

solution:

Let’s go to the system to check whether the Linux subsystem of Windows is enabled. The steps are as follows:
Control Panel -> Programs -> Programs and Features

Check if you have checked here: Enable Windows Subsystem for Linux

If not, we check it, restart the computer, and open Docker.
If you still report WSL 2 installation is incomplete. problem. There is only one reason left:
the version of wsl2 we are using is very old, so it needs to be updated manually. We can download the latest version of wsl2 from Microsoft’s official website according to the prompt, and then open it normally.
Visit the link below to download and install the update:

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

If the download is slow, use the Google browser to download, it is easy to use!
Install the latest version of wsl2:
insert image description here
reboot. run.

So far, most of them can run successfully. If not, there is the ultimate trick:
if you report an error at this time System.InvalidOperationException: Failed to set version to docker-desktop: exit code: -1

The error is as follows:

System.InvalidOperationException:
Failed to set version to docker-desktop: exit code: -1
 stdout: �S��v�[a�{|�W
N/ec\Ջ�v�d\O0
stderr: 
   在 Docker.ApiServices.WSL2.WslShortLivedCommandResult.LogAndThrowIfUnexpectedExitCode(String prefix, ILogger log, Int32 expectedExitCode) 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\WSL2\WslCommand.cs:行号 146
   在 Docker.Engines.WSL2.WSL2Provisioning.<ProvisionAsync>d__8.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Provisioning.cs:Line 82
--- The end of the stack trace in the previous location where the exception was raised ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Docker.Engines.WSL2.LinuxWSL2Engine.<DoStartAsync>d__26.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\LinuxWSL2Engine.cs:行号 104
--- The end of the stack trace in the previous location where the exception was raised ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Docker.ApiServices.StateMachines.TaskExtensions.<WrapAsyncInCancellationException>d__0.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\TaskExtensions.cs:行号 29
--- The end of the stack trace in the previous location where the exception was raised ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:行号 67
--- The end of the stack trace in the previous location where the exception was raised ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() 位置 C:\workspaces\PR-15387\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:行号 92

We open cmd as an administrator:
enter:

netsh winsock reset

Execute, 100% solve this problem!

Note: This command should be used with caution. This is to delete the original docker system, which is equivalent to resetting docker-desktop. The images and containers in me are gone. Restarting docker-desktop will regenerate docker-desktop and docker-desktop-data
insert image description here

[Solved] docker Error: bridge docker0 failed: exchange full

Error reported: Bridge docker0 failed: exchange full

the default docker0 bridge only supports 1024 links. If it exceeds 1024, it will report bridge docker0 failed: exchange full

you can remove the restriction by creating another network bridge. When docker run creates a container, you specify our own network bridge. Of course, we only support 1024 network bridges. You can use this method to create unlimited network bridges as long as there is enough memory to create a docker container

1. View Bridge

[root@bj ~]# docker network ls
NETWORK ID     NAME      DRIVER    SCOPE
0c49b2d827f5   bridge    bridge    local
8ec28361848f   host      host      local
3b929af4064c   none      null      local

2. Create Bridge

[root@bj ~]# docker network create xinnet
[root@bj ~]# docker network ls
NETWORK ID     NAME      DRIVER    SCOPE
0c49b2d827f5   bridge    bridge    local
8ec28361848f   host      host      local
3b929af4064c   none      null      local
604ccc72661a   xinnet    bridge    local
[root@bj ~]# docker network inspect xinnet
[
    {
        "Name": "xinnet",
        "Id": "604ccc72661af52f0889bfea4664d70e899427418b1a9301d8a46e6ce95e46ee",
        "Created": "2021-12-08T13:50:43.973901095+08:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.19.0.0/16",
                    "Gateway": "172.19.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "e92f81a6fe11b6e2c82de38fbe4e06a9cfcdb1dcd1f64485e5b805e3714bd163": {
                "Name": "zabbix-agent-22000",
                "EndpointID": "b7ac1a57b2e91435c676a7b4203ab50237893a3714aff185d8cdac45b1251356",
                "MacAddress": "02:42:ac:13:00:02",
                "IPv4Address": "172.19.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

3. Create container specified bridge – network

[root@bj ~]# docker run -m 100m --name zabbix-agent-22001 --network=xinnet -e HOSTNAME="TEST22001" -e ZBX_HOSTNAME="TEST22001" -e ZBX_SERVER_HOST="10.20.9.246" -p 22001:10050 -e ZBX_SERVER_PORT=10051 -d zabbix-agent:4.0.35 
[root@bj ~]# docker ps -a
CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS          PORTS                      NAMES
e92f81a6fe11   zabbix-agent:4.0.35   "/usr/bin/tini -- /u…"   15 minutes ago   Up 15 minutes   0.0.0.0:22001->10050/tcp   zabbix-agent-22001

If – network is not specified, the created containers will be hung on docker0 by default, and the IP of docker0 interface on the local host will be used as the default gateway for all containers

Docker Error: error invoking remote method ‘docker-start-container‘: error: (http code 500) server error –

Docker container cannot be started. An error is reported after startup:

error invoking remote method 'docker-start-container': error: (http code 500) server error - ports are not available: listen tcp 0.0.0.0:3306: bind: an attempt was made to access a socket in a way forbidden by its access permissions.

First restart the computer (host), and then execute it on the command line (or wsl2)

docker ps -a

Check the container ID that cannot be started, and then execute

docker restart Container ID

If it still cannot be started, try to allow the windows (Linux) firewall to pass through the port and make sure it is not blocked by the firewall

[Win 10] Docker Error: error during connect: In the default daemon configuration on Windows

error during connect: In the default daemon configuration on Windows, 
the docker client must be run with elevated privileges to connect.: 
Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json: 
open //./pipe/docker_engine: The system cannot find the file specified.

solution: 

cd "C:\Program Files\Docker\Docker"
DockerCli.exe -SwitchDaemon

[Solved] Docker Error: got permission denied while trying to connect to the docker daemon socket at…

Problem Description:
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.40/version: Dial UNIX/var/run/docker.sock: Connect: permission denied
error reason:
docker process uses UNIX socket instead of TCP port. By default, UNIX socket belongs to the root user and needs root permission to access it
solution:

sudo groupadd docker     #Add the docker user group
sudo gpasswd -a $USER docker #Add the logged-in user to the docker user group
newgrp docker #Update the user group
docker ps #Test that the docker command works properly with sudo

[Solved] Docker Error: Failed to connect to bus: Host is down

docker run -itd –privileged –name=apache -v /var/www/html/:/var/www/html/ -p 8888:80 myapache:v1 /usr/sbin/init

Remember, remember

Error content:

The system has not been booted with systemd as init system (PID 1). Can’t operate.
Failed to connect to bus: Host is down

Solution:

docker run -itd    — privileged –name myCentos centos /usr/sbin/init

After creation: use the following command to enter the container

docker exec -it myCentos /bin/bash

Pay special attention to the bold content and don’t forget it

The reason is that/bin/Bash is executed in the first step by default, and systemctl cannot be used because of a bug in docker

Therefore, we use/usr/SBIN/init and — privileged, so that we can use systemctl, but override the default/bin/bash

Therefore, if we want to enter the container, we can no longer use docker attach mycentos

Instead, you can only use   docker exec -it myCentos /bin/bash   Because exec allows us to execute the overridden default command/bin/bash

At the same time -it is also necessary.