Docker Community Forums

Share and learn in the Docker community.

Socket file issue inside docker

docker

(Mitzkia) #1

I have a small Dockerfile and a script.sh file. I found an “interesting” issue when I build the Dockerfile. Briefly: inside Dockerfile the script.sh creates a socket file, and after it I check the type of the file, if it is a socket or not. First I check it from the script.sh file (from where it created), it shows it is a socket. After that I check it again with the same command, but from the Dockerfile and it shows it is a regular file. Can it be a bug, or I miss something? Thanks a lot.

docker --version: Docker version 1.12.3, build 6b644ec

docker build --no-cache=True -t centos .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM centos:latest
 ---> 0584b3d2cf6d
Step 2 : COPY script.sh /script.sh
 ---> 1a62c6a1e315
Removing intermediate container 5747cac36bc9
Step 3 : RUN ./script.sh
 ---> Running in 621327e83abf
+ python -c 'import socket as s; sock = s.socket(s.AF_UNIX); sock.bind('\''/tmp/somesocket'\'')'
+ ls -la /tmp/somesocket
srwxr-xr-x 1 root root 0 Nov 15 05:22 /tmp/somesocket
 ---> dc96626a7a9b
Removing intermediate container 621327e83abf
Step 4 : RUN ls -la /tmp/somesocket
 ---> Running in e8ff8f107a9f
-rwxr-xr-x 1 root root 0 Nov 15 05:22 /tmp/somesocket
 ---> 31a5fafc5bbd
Removing intermediate container e8ff8f107a9f
Successfully built 31a5fafc5bbd