Tag Archives: docker

Docker run error: docker0: iptables: No chain/target/match by that name.

 

Docker operation reported an error. Docker 0: iptables: no chain/target/match by that name.
recently, I installed services on a new server, but I didn’t install iptables. Later, after installing iptables, I suddenly found that my docker couldn’t run
note that other people may not be able to do it. My reason is that I didn’t install iptables on the new server at first. I installed the docker first, and then stopped the default firewall and installed iptables. This is the problem. For other reasons, I don’t know if this method is feasible?First look at the errors:
the following errors were made during the operation:

docker start error
Error response from daemon: No such container: yn-userservice-30000
26126ca87430b74c3987817492cc890e72c36e2fec10d807e362a12f22365160
/usr/bin/docker-current: Error response from daemon: driver failed programming external
 connectivity on endpoint yn-userservice-30000 (5d083ef51f932ac24936713ab3bc1cece9d47feabf4a916cf5da12a4fb2a122a):  
 (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 30000 -j DNAT --to-
 destination 172.17.0.2:30000 ! -i docker0: iptables: No chain/target/match by that name.

Later, I searched the Internet and found that the solution is very simple, as follows:

1. Stop docker service

enter the following command to stop the docker service

systemctl stop docker  or service docker stop

If the stop is successful, then enter docker ps to prompt the following words:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Save iptables

2. enter the following command:

iptables-save >  /etc/sysconfig/iptables

I found that the files before and after the firewall configuration file /etc/sysconfig/iptables are as follows. Of course, I can’t understand it, so I will set an inbound port
to save the contents of the previous file:

# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10001 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10002 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10003 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10004 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

Saved file content:

# Generated by iptables-save v1.4.21 on Sat Nov 24 13:53:13 2018
*nat
:PREROUTING ACCEPT [261:18558]
:INPUT ACCEPT [17:969]
:OUTPUT ACCEPT [4:304]
:POSTROUTING ACCEPT [4:304]
COMMIT
# Completed on Sat Nov 24 13:53:13 2018
# Generated by iptables-save v1.4.21 on Sat Nov 24 13:53:13 2018
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1246:135222]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10001 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10002 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10003 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10004 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Sat Nov 24 13:53:13 2018
3. Start docker service

after saving iptables , you can restart docker. Enter the following command:

systemctl start docker or service docker  start

Set docker to start

4. after setting this, you don’t need to set it again

systemctl enable docker
5, start container

finally, the container was started and no more errors were reported

docker start container id/name

The solution of docker error docker: invalid reference format

Why can’t you stop buying 618?From the technical dimension to explore>>>

Operation

docker run –it –v /dataset:/dataset –v /inference:/inference –v /result:/result floydhub/pytorch:0.4.0-py2.29 /inference/inference.sh

Error report

docker: invalid reference format.
See 'docker run --help'.

It turns out that… It turns out that… The - copied from the website should be -

So this tells us that as publishers, we must use & lt; code> tags wrap up codes, commands and so on, and please don't let full angle symbols come out to harm people. As a user, I have to be more careful

It's just.. Irritating! Waste your life! Bullying novices

Culprit: http://challenge.xfyun.cn/aicompetition/techDetail

After replacing the normal half width symbol with - , the execution result on MAC is as follows:

docker: Error response from daemon: Mounts denied:
The paths /result and /inference and /dataset
are not shared from OS X and are not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.

That is, the root directory / is not shared. You can add these subdirectories to the shared directory (select "preferences" on the docker icon and add them under the "file sharing" tab). Or change the path like me:

docker run -it -v ~/dataset:/dataset -v ~/inference:/inference -v ~/result:/result floydhub/pytorch:0.4.0-py2.29 /inference/inference.sh

Solution for docker under windows:This error may also indicate that the docker daemon is not running.

error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.35/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

How to Solve this error:

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

After the above operation, the problem is solved

 

Docker startup container Error response from daemon: OCI runtime create failed: container_ linux.go:349

This is the error reported to start the container, docker logs is not, the container is created, but can not start the container
Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused “process_linux.go:449: container init caused “rootfs_linux.go:58: mounting \”/etc/timezone\” to rootfs \”/var/lib/docker/overlay2/132f5ea82c98a1206ccb13e13f06c96737036c722c290e989b462c2d77458a8f/merged\” at \”/var/lib/docker/overlay2/132f5ea82c98a1206ccb13e13f06c96737036c722c290e989b462c2d77458a8f/merged/etc/timezone\” caused \“not a directory\”””: unknown: Are you trying to mount a directory onto a file (or vice-versa)?Check if the specified host path exists and is the expected type
Error: failed to start containers: 6e3a9e751884
Check that it is a mapping problem, after checking that the host does not have a directory to be mapped, create the directory and the container will start normally.

Docker OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caus

docker executes the command:docker exec -it 1e33b26152e1 /bin/bash
Error on entering container: OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused “exec: \”/bin/bash\”: stat /bin/bash: no such file or directory”: unknown
Error scenario:I am pulling a registry image to build a private repository. I ran the registry image and then entered the container.
Solution:
docker exec -it 1e33b26152e1 /bin/sh
or
docker exec -it 1e33b26152e1 bash
or
docker exec -it 1e33b26152e1 sh

Docker Cannot Start: Failed to start Docker Application Container Engine

After the docker on the virtual machine is shut down, it can’t be started. The specific exception is as follows

At startup:

[root@localhost docker]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

Follow the prompts

[root@localhost docker]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2018-06-29 14:31:59 CST; 7s ago
     Docs: http://docs.docker.com
  Process: 2627 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=125)
 Main PID: 2627 (code=exited, status=125)

Jun 29 14:31:59 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
Jun 29 14:31:59 localhost.localdomain dockerd-current[2627]: flag provided but not defined: --init-path
Jun 29 14:31:59 localhost.localdomain dockerd-current[2627]: See '/usr/bin/dockerd-current --help'.
Jun 29 14:31:59 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=125/n/a
Jun 29 14:31:59 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jun 29 14:31:59 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jun 29 14:31:59 localhost.localdomain systemd[1]: docker.service failed.

Execute journalctl – Xe to display more detailed exception:

-- 
-- Unit docker.service has begun starting up.
Jun 29 13:49:23 localhost.localdomain dockerd-current[5059]: flag provided but not defined: --init-path
Jun 29 13:49:23 localhost.localdomain dockerd-current[5059]: See '/usr/bin/dockerd-current --help'.
Jun 29 13:49:23 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=125/n/a
Jun 29 13:49:23 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is failed.
Jun 29 13:49:23 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jun 29 13:49:23 localhost.localdomain systemd[1]: docker.service failed.
Jun 29 13:49:23 localhost.localdomain polkitd[634]: Unregistered Authentication Agent for unix-process:5014:423047 (system bus name :1.40, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Jun 29 13:52:05 localhost.localdomain polkitd[634]: Registered Authentication Agent for unix-process:5079:439186 (system bus name :1.41 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Jun 29 13:52:05 localhost.localdomain systemd[1]: Starting Docker Storage Setup...
-- Subject: Unit docker-storage-setup.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
...........
...........

Here is the exception information. If the error code displayed during the execution of systemctl status docker.service is 125, please continue to look down. Only one same error is found on stack overflow, and it has not been solved.

After several hours, all kinds of schemes on the Internet failed. In the end, I focused on the following two main information points:

1、Process: 2533 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=125)
2、flag provided but not defined: --init-path

The information given here is that init path is not defined. Secondly, the first information lists a series of startup dependencies. It is obvious that there is something wrong with the configuration of my local environment. So my starting point is to copy the corresponding files from an OK node

/Usr/bin/docked current/usr/libexec/docker/docker runc current/usr/libexec/docker/docker proxy current/usr/libexec/docker/docker init current/etc/docker/seccomp.json. After copying to the corresponding directory, docker starts normally.

If not, synchronize the contents of/etc/SYSTEMd/system/docker. Service
during this period, you may need to execute systemctl daemon reload first, and then systemctl restart docker.service.

For some solutions mentioned on the Internet, if some files cannot be found, such as docker.sock, you can execute sudo docker daemon – D.

In addition, we should pay special attention to the fact that many schemes delete the folder/var/lib/docker/but my suggestion is never to do so, otherwise your containers will be destroyed. If you can’t, you can back it up first, and then replace it.

Failed to start docker.service: Unit not found(Docker service does not start)

Linux deployment docker appears: failed to start docker.service : unit not found
linux has deployed k8s and other projects before, Some of the remaining dockers are damaged
after re installation, the service always fails: failed to start docker.service : unit not found
warning: if applicable to my situation, it needs to be reinstalled

solution:
Direct Yum update
be sure to restart Linux
Yum install docker
systemctl start docker.service

When Docker installs an Mirror: failed to get default registry endpoint from daemon

1.docker pull ubuntu:18.04

Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon. Is the docker daemon running on this host?). Using system default:https://index.docker.io/v1/
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

The reason is no sudo, the correct way to write sudo docker pull + software or resources to be installed.

【docker】 yaml.scanner.ScannerError: mapping values are not allowed here in “./docker-compo…

An error was reported when starting docker compose

Command:

docker-compose up -d && docker-compose logs -f

Error code:

Solution

The reason for this error is that the YML format is incorrect. The YML format defined by Google is too strict. Every colon must be followed by a space

Original format:

version:"3"
services:
  web:   
    image: licerlee/friendlyhello:v1
    deploy:
      replicas:5
      resources:
        limits:
          cpus:"0.1"
          memory:50M
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"
    networks:
      - webnet
networks:
  webnet:

Change to:

version: "3"
services:
  web:
   
    image: licerlee/friendlyhello:v1
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"
    networks:
      - webnet
networks:
  webnet:

Note: the above example is for illustration only, not the configuration file of my project

When executing the command:

It’s over!