简体   繁体   中英

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

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

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.

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

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM