LXD , docker , mariadb/mysql

Hi,
I’m looking for a Docker image of mariadb/mysql that would work out of the box in an LXD container :slight_smile:

So far, I tried a lot of them, it does not work . They can’t start .
Another Docker image like nginx works fine.

Here are some image/error

mariadb:10.3

error: exec: "/usr/local/bin/docker-entrypoint.sh": stat /usr/local/bin/docker-entrypoint.sh: permission denied

**webhippie/mariadb:latest **

Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
2017-10-02 22:08:51 139784837237576 [Note] /usr/bin/mysqld (mysqld 10.1.26-MariaDB) starting as process 48 ...
2017-10-02 22:08:51 139784837237576 [ERROR] mysqld: File './mysql-bin.index' not found (Errcode: 13 "Permission denied")
2017-10-02 22:08:51 139784837237576 [ERROR] Aborting

171002 22:11:24 mysqld_safe Logging to '/var/lib/mysql/test-dock.err'.
171002 22:11:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/bin/mysqld_safe_helper: Can't create/write to file '/var/lib/mysql/test-dock.err' (Errcode: 13 "Permission denied")

bitnami/mariadb:latest

nami    INFO  Initializing mariadb
mariadb INFO  ==> Cleaning data dir...
mariadb INFO  ==> Configuring permissions...
mariadb INFO  ==> Validating inputs...
mariadb INFO  ==> Initializing database...
Error executing 'postInstallation': Error: spawnSync /opt/bitnami/mariadb/bin/mysql_install_db EACCES

It look that it’s an error about access/right but everything looks good.
The other image (nginx) with local volume works well.
Any idea?

docker version
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:42:45 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:41:24 2017
 OS/Arch:      linux/amd64
 Experimental: false

Same thing with the package docker.io instant of docker-ce

lxd/lxc version 2.18
Nesting is true

Thanks for your help

Most likely it is an issue with which docker distribution you are using.
Do you follow the instructions at https://stgraber.org/2016/04/13/lxd-2-0-docker-in-lxd-712/ (docker from Ubuntu repositories)?

An alternative would be to install the DB in the LXD container, without docker.

I did try the docker from Ubuntu repo, it’s the same behavior
This version of docker is supposed to work

https://jenkins.linuxcontainers.org/job/lxd-test-docker/

This version is supposed to have the patch to work with LXD (https://github.com/lxc/lxd/issues/3349)

And it’s exactly the same behavior with docker.io from Ubuntu.
I’m trying to see why this is not working as expected.

If it’s a bug from docker (both the original and the one from ubuntu) or a bug with LXD so I can report as a bug.

I Hope someone can try to install docker and run a mysql/mariadb container like

docker run --name some-mariadb -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb:latest
or/and
docker run --name some-mariadb2 -v /datas/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb:latest

Cheers,
Benoit

Run

docker info

so that we can see what was selected for the storage driver.

My guess is that vfs was auto-selected, which can cause this issue.
The blog post by @stgraber talks about the overlay (perhaps also overlay2) storage driver.

How do you specify the storage driver in Docker?

You are right:

Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 27
Server Version: 17.09.0-ce
Storage Driver: vfs
Logging Driver: json-file

I will try overlayfs and get back :slight_smile:

Well, it looks like it only work with privileged container, unfortunately
Whatever the Strorage Driver.