Docker and Mysql: libz.so.1: cannot open shared object file: Permission denied Docker and Mysql: libz.so.1: cannot open shared object file: Permission denied docker docker

Docker and Mysql: libz.so.1: cannot open shared object file: Permission denied


Deleting the container solve this problem for me.

Update: That solution worked not so long.

So I kept searching and found something related with Apparmor.

If you have mysql installed on your host, Apparmor may restrict access of this shared library for mysql installed on your docker container. The following fixed the problem:

#Type this on your host terminalsudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld


So I solved the issue by using the devicemapper storage backend, as suggested by @jpetazzo.

Steps I carried out:

  1. Stopped the docker deamon
  2. Started the docker deamon with command docker -d -s="devicemapper"
  3. Ran the docker run on the Dockerfile command again. And it worked without any problems.


If you have mysql-server installed on your host machine, then it installs an apparmor profile for mysqld. For me, the problem went away after I disabled the mysqld apparmor profile on the host with the following commands:

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld

Of course, this also means that apparmor will be disabled for mysqld on your host. I don't use mysqld so I'm okay with that.