error de docker: / var/run / docker.sock: no hay tal archivo o directorio


Soy nuevo en docker. Tengo un script de shell que carga datos en impala y quiero un archivo docker que ejecute construye una imagen y ejecuta el contenedor. Estoy en mac, instalado boot2docker y tengo el env DOCKER_HOST configurado.

bash-3.2$ docker info
Containers: 0
Images: 0
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Dirs: 0
Execution Driver: native-0.2
Kernel Version: 3.15.3-tinycore64
Debug mode (server): true
Debug mode (client): false
Fds: 10
Goroutines: 10
EventsListeners: 0
Init Path: /usr/local/bin/docker
Sockets: [unix:///var/run/docker.sock tcp://0.0.0.0:2375]

Estoy tratando de instalar una imagen pre-construida usando:

sudo docker pull busybox

Recibo este error:

sudo docker pull busybox 2014/08/18 17:56:19 Post http:///var/run/docker.sock/images/create?fromImage=busybox&tag=: dial unix /var/run/docker.sock: no such file or directory

¿Hay algún problema con la configuración de mi docker?

Cuando hago un docker pull busybox, Extrae la imagen y la descarga está completa.

bash-3.2$ docker pull busybox
Pulling repository busybox
a9eb17255234: Download complete 
fd5373b3d938: Download complete 
d200959a3e91: Download complete 
37fca75d01ff: Download complete 
511136ea3c5a: Download complete 
42eed7f1bf2a: Download complete 
c120b7cab0b0: Download complete 
f06b02872d52: Download complete 
120e218dd395: Download complete 
1f5049b3536e: Download complete 
bash-3.2$ docker run busybox /bin/echo Hello Doctor
Hello Doctor

Soy ¿falta algo?

Author: Bonifacio2, 2014-08-19

11 answers

No necesita ejecutar ningún comando docker como sudo cuando está utilizando boot2docker ya que cada comando pasado a la máquina virtual boot2docker se ejecuta como root de forma predeterminada.

Está viendo el error cuando se está ejecutando como sudo porque sudo no tiene el env DOCKER_HOST establecido, solo su usuario lo hace.

Puede confirmar esto haciendo a:

$ env

Entonces un

$ sudo env

Y buscando DOCKER_HOST en cada salida.

En cuanto a tener un archivo docker que ejecute tu script, algo como esto podría funcionar para usted:

Dockerfile

FROM busybox

# Copy your script into the docker image
ADD /path/to/your/script.sh /usr/local/bin/script.sh

# Run your script
CMD /usr/local/bin/script.sh

Entonces puedes ejecutar:

docker build -t your-image-name:your-tag .

Esto construirá su imagen de docker, que puede ver haciendo un:

docker images

Entonces, para ejecutar su contenedor, puede hacer un:

docker run your-image-name:your-tag

Este comando run iniciará un contenedor desde la imagen que creó con su Dockerfile y su comando build y luego terminará una vez que su script.sh haya terminado de ejecutarse.

 85
Author: Chris McKinnel,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-08-18 22:25:25

Puede configurar rápidamente su entorno utilizando shellinit

En el símbolo del sistema, ejecute:

$(boot2docker shellinit)  

Que completará y exportará las variables de entorno e inicializará otras características.

 45
Author: user848337,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-11-07 18:43:07

En mi MAC cuando inicio boot2docker-vm en el terminal usando


boot2docker start

Veo lo siguiente


To connect the Docker client to the Docker daemon, please set:
    export DOCKER_CERT_PATH=
    export DOCKER_TLS_VERIFY=1
    export DOCKER_HOST=tcp://:2376

Después de configurar estas variables de entorno, pude ejecutar la compilación sin el problema.

Actualización [2016-04-28] Si está utilizando una de las versiones recientes de docker puede hacer

eval $(docker-machine env) establecerá el entorno

(docker-machine env imprimirá las declaraciones de exportación)

 25
Author: Jerome Anthony,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-26 23:39:58

docker pull fallará si docker service no se está ejecutando. Asegúrese de que se está ejecutando por

:~$ ps aux | grep docker
root     18745  1.7  0.9 284104 13976 ?   Ssl  21:19   0:01 /usr/bin/docker -d

Si no se está ejecutando, puede iniciarlo mediante

sudo service docker start

Para Ubuntu 15 y superior use

sudo systemctl start docker

 24
Author: Harikrishnan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-04-14 13:30:31

También tengo este error. Sin embargo, yo no usé boot2docker pero acabo de instalar docker"plain" en Ubuntu (ver https://docs.docker.com/installation/ubuntulinux/).

Tengo el error ("dial unix /var/run/docker.sock: no hay tal archivo o directorio. ¿Está intentando conectarse a un demonio habilitado para TLS sin TLS?") porque el demonio docker aún no se estaba ejecutando.

En Ubuntu, necesitas iniciar el servicio :

sudo service docker start

Véase también http://blog.arungupta.me/resolve-dial-unix-docker-sock-error-techtip64

 16
Author: Jörg,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-27 09:20:01

Para boot2docker en Windows, después de ver:

FATA[0000] Get http:///var/run/docker.sock/v1.18/version: 
dial unix /var/run/docker.sock: no such file or directory.  
Are you trying to connect to a TLS-enabled daemon without TLS?

Todo lo que hice fue:

boot2docker start
boot2docker shellinit

Que generó:

export DOCKER_CERT_PATH=C:\Users\vonc\.boot2docker\certs\boot2docker-vm
export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://192.168.59.103:2376

Finalmente:

boot2docker ssh

Y docker funciona de nuevo

 9
Author: VonC,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-26 18:35:55

En Linux, primero ejecuta sudo service docker start en terminal.

 6
Author: Mohsen Kashi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-30 10:24:01

Si está utilizando CentOS 7 y ha instalado Docker a través de yum, no olvide ejecutar:

$ sudo systemctl start docker
$ sudo systemctl enable docker

Esto iniciará el servidor, así como reiniciarlo automáticamente al arrancar.

 5
Author: Lee Benson,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-09-16 18:56:28

Para configurar su entorno y mantenerlo para las sesiones futuras puede hacer:

echo 'export DOCKER_HOST="tcp://$(boot2docker ip 2>/dev/null):2375";' >> ~/.bashrc

Entonces: source ~/.bashrc

Y su entorno se configurará en cada sesión

 4
Author: Lt.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-12-03 21:10:17

El primer /var/run/docker.sock se refiere a la misma ruta en su máquina virtual boot2docker. Escribir correctamente para windows / var/run / docker.calcetín

 0
Author: M. Dicon,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-19 05:44:05

Usted, tal vez el no el OP, pero alguien puede tener un directorio llamado /var/run/docker.sock/ ya debido a la cantidad de veces que hackear y barra para hacer las cosas bien con docker (especialmente noobs). Borra ese directorio e inténtalo de nuevo.

Esto me ayudó en mi camino para que funcione en Centos 7.

 0
Author: pjammer,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-13 13:13:44