2

I'm using Docker version:

Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:25:01 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:25:01 UTC 2015
 OS/Arch:      linux/amd64

I'm on Centos 7 I have a Jenkins-container running in my Docker Environment. When I'm accessing the Jenkins-container and try to perform a Docker-command I got this error:

libsystemd-journal.so.0: cannot open shared object file: No such file or directory

I tried:[root@localhost lib64]# sudo ln -s /usr/lib64/libsystemd.so.0 libsystemd.so.0 ln: failed to create symbolic link ‘libsystemd.so.0’: File exists

I saw this issue after solving this: question

Here is the same issue: https://botbot.me/freenode/docker/2015-12-01/?page=4

Community
  • 1
  • 1

3 Answers3

4

After multiple comments on the previous question, the OP Jenson confirms making it work with:

I will have to make a dockerfile because the run command is too much.
But it works at the moment:

docker run -d --name jenkins --volumes-from jenkins-dv --privileged=true \
-t -i \
-v /var/run/docker.sock:/var/run/docker.sock 
-v $(which docker):/bin/docker \ 
-v /lib64/libsystemd-journal.so.0:/usr/lib/libsystemd-journal.so.0 \
-v /lib64/libsystemd-id128.so.0:/usr/lib/libsystemd-id128.so.0 \
-v /lib64/libdevmapper.so.1.02:/usr/lib/libdevmapper.so.1.02 \
-v /lib64/libgcrypt.so.11:/usr/lib/libgcrypt.so.11 \
-v /lib64/libdw.so.1:/usr/lib/libdw.so.1 \
-p 8080:8080 jenkins

I mentioned that running docker from a container ("cic": "container-in-container") means mounting the docker executable and /var/run/docker.sock.
Apparently, that particular image needs a bit more to run from within a container.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
3

For my developer environment, I'm runnining docker-compose and I connect to the ubuntu image container (14.04 LTS) (I mount the /var/run/docker.sock as well).

Since an update of my host ubuntu system yesterday evening, I had the same error when I wanted to run a docker command inside the dev container :

[dev@docker_dev]:~$ docker ps
docker: error while loading shared libraries: libsystemd-journal.so.0: cannot open shared object file: No such file or directory

So I did an update and I installed libsystemd-journal0 :

[dev@docker_dev]:~$ sudo apt-get update
[dev@docker_dev]:~$ sudo apt-get install libsystemd-journal0

And now my dev container is working fine with docker commands

Bruno Thomas
  • 1,179
  • 17
  • 31
  • 1
    with Docker 1.10 I also had to install apparmor – MrE Mar 31 '16 at 03:20
  • thank you, I just saw that I had apparmor in my docker container. – Bruno Thomas Mar 31 '16 at 07:40
  • 1
    with docker 1.10, a lot has changed and there are new dependencies. their site recommends using their docker container for docker in docker. @ docker hub _/docker – MrE Mar 31 '16 at 22:03
  • actually, for my dev container I was using a phusion/baseimage (with docker 1.10.3). So I tried to do an image from scratch of ubuntu 14.04LTS. The package dependencies of docker-engine are pulling apparmor, libsystemd-journal0 and a bunch of libraries. So it works fine. Cf https://gist.github.com/bamthomas/8308226ef354a1405ad75f74a7016b13 – Bruno Thomas Apr 01 '16 at 08:49
0

From the error, it appears that the shared library required by your executable is missing. One way to resolve this issue is:

  1. Use "COPY" command inside Dockerfile to copy the shared libraries/dependencies inside the container. Example: COPY {local_path} {docker_path}
  2. Then, set the environment variable where shared libraries are searched for first before the standard set of directories. For instance for Linux based OS, LD_LIBRARY_PATH is used. Environment variables can be set via Docker's Environment replacement (ENV). Example: ENV LD_LIBRARY_PATH={docker_path}:$LD_LIBRARY_PATH

Other is to statically link your binary with the dependencies (language dependent).

Nikita Jain
  • 669
  • 8
  • 11