Docker Community Forums

Share and learn in the Docker community.

Docker inside docker

docker

(Asim42) #1

OS Version: Ubuntu 16.04
Build: Docker version 17.06.1-ce, build 874a737

The docker container is unable to find docker binary when doing docker inside docker. I use stakater/base-alpine:3.6 as base image and map the host docker inside it as a volume using this command

sudo docker run -i --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker --name kat stakater/base-alpine:3.6

I have also tried Ubuntu as base image since my host machine is Ubuntu by this command

sudo docker run -i --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker --name ubu ubuntu:16.04

then bash into it by

sudo docker exec -it ubu bash

and docker command gives this error:

docker: error while loading shared libraries: libltdl.so.7: cannot open shared object file: No such file or directory


(Think) #2

then also mount this library like
-v /usr/lib/x86_64-linux-gnu/libltdl.so.7:/usr/lib/libltdl.so.7


(Asim42) #3

It did something but now calling docker commands returns this error:

bash: /usr/bin/docker: No such file or directory


(Think) #4

what does docker run ..... ls -lisa /usr/bin/docker return?
and what does docker run .... ldd /usr/bin/docker return?


(Rosch100) #5

Hello,
I’m facing the same issue. It used to work in previous docker versions. Inside my container, I receive:

bash-4.4# ls -lisa /usr/bin/docker
7347489  37356 -rwxr-xr-x    1 root     root      38249456 Mar 22 00:08 /usr/bin/docker
bash-4.4# ldd /usr/bin/docker
        /lib64/ld-linux-x86-64.so.2 (0x7f65e8285000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f65e8285000)
        libltdl.so.7 => /usr/lib/libltdl.so.7 (0x7f65e807b000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f65e8285000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f65e8285000)
Error relocating /usr/lib/libltdl.so.7: argz_create_sep: symbol not found
Error relocating /usr/lib/libltdl.so.7: __rawmemchr: symbol not found
Error relocating /usr/lib/libltdl.so.7: argz_append: symbol not found
Error relocating /usr/lib/libltdl.so.7: argz_stringify: symbol not found
Error relocating /usr/lib/libltdl.so.7: argz_insert: symbol not found
Error relocating /usr/lib/libltdl.so.7: __sprintf_chk: symbol not found