Thursday, 15 April 2010

sockets - /var/run/docker.sock unaccessible in container running on centos 7 -


I am launching a container that runs a bass script that uses the dockkey 1.3.2 docker internally is. 1406 files / commands are on

Doker build requires access to the dockers socket, so I use a common move, such as:

  -v / var / run / Docker Sock: /var/run/docker.sock  

Before launch I run a check in the script:

  If [-e "/ var / Run / docker.sock "]; Then the "docker.sock got" echo the other echo "docker.sock not found" fi  

and "echo" shows that docker.sock is not found. It is found that the check is carried out outside the container outside the pseudo.

I tried to add "--permissive = true" to the "Docker Run" command line, but no explicit change was made.

Here are some references to the same problem: It targets Fedora / RHEL, but does not solve this problem, either to ensure that I am in Selenux approved mode If I use "SetenFrof permissible" and Cestatus, then this problem remains unresolved.

I also tried to add "--security-opt = label: type: docker_t" to dock, according to the command line, there is no clear effect.

Sealenx policy for Docker is described here:.

A lot of information, but I'm not sure if Selenux is contributing to the problem. If I reboot the / etc / selinux / config to disable selinux and run sestatus, it indicates that Selenux is disabled, but the problem remains.

About this, it may be related to:. Using this trick to run the docker inside the container is quite common, but it is probably a better way of doing better or better action. I am considered fine, but this is a work and it is widely used, simple (on the surface), the approach to running a Doker build inside a container is probably a simple solution.

Any help would be appreciated! Thanks

I think your problem may be due to the misunderstanding of -v option to Docker Run . You say that you did

  -v / var / run / docker: / var / run / docker  

This creates a tie mount in the container file Or directory / var / run / docker . But in your case, there is no such file or directory. You want the file /var/run/docker.sock . You should

  -v /var/run/docker.sock:/var/run/docker.sock  

to mount that file Need to be in the container

As / var / run / docker did not exist, you might wonder why Docker did not tell you about the error but -v < The / code> option is astonishing behavior that if the path does not exist on the host, then the Docker will make it as a directory, then you can put a useless blank / var / run / docker directory on the host and container Ends with.

In principle, you mount the directory containing the bind to run -v / var /: / var / run but the host / var / run It's a bad idea to use the container's container tree.

And as you are on CentOS, you will need to use for access

to work with SELinux / var / run / docker. On sock

No comments:

Post a Comment