Unable to run mariadb when mount volume - docker

Using the following docker-compose.yml file
version: '2'
services:
wordpress:
image: wordpress
ports:
- 8080:80
environment:
WORDPRESS_DB_NAME: my_db
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
volumes:
- ./src:/var/www/html
mysql:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: password
volumes:
- ./data_dir:/var/lib/mysql
when running docker-compose up commande,its giving me following error
Starting wp_mysql_1
Starting wp_wordpress_1
Attaching to wp_mysql_1, wp_wordpress_1
wordpress_1 |
wordpress_1 | Warning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 19
wordpress_1 |
wordpress_1 | MySQL Connection Error: (2002) Connection refused
mysql_1 | 2016-11-28 15:47:02 139858949081024 [Note] mysqld (mysqld 10.1.19-MariaDB-1~jessie) starting as process 1
...
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] InnoDB: The InnoDB memory heap is disabled
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory
barrier
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] InnoDB: Compressed tables use zlib 1.2.8
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] InnoDB: Using Linux native AIO
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] InnoDB: Using SSE crc32 instructions
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] InnoDB: Initializing buffer pool, size = 256.0M
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] InnoDB: Completed initialization of buffer pool
mysql_1 | 2016-11-28 15:47:03 139858949081024 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different
size 0 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages
!
mysql_1 | 2016-11-28 15:47:03 139858949081024 [ERROR] InnoDB: Could not open or create the system tablespace. If yo
u tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in
my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote th
ose files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain
your precious data!
mysql_1 | 2016-11-28 15:47:03 139858949081024 [ERROR] Plugin 'InnoDB' init function returned error.
mysql_1 | 2016-11-28 15:47:03 139858949081024 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mysql_1 | 2016-11-28 15:47:03 139858949081024 [Note] Plugin 'FEEDBACK' is disabled.
mysql_1 | 2016-11-28 15:47:03 139858949081024 [ERROR] Could not open mysql.plugin table. Some plugins may be not lo
aded
mysql_1 | 2016-11-28 15:47:03 139858949081024 [ERROR] Unknown/unsupported storage engine: InnoDB
mysql_1 | 2016-11-28 15:47:03 139858949081024 [ERROR] Aborting
mysql_1 |
wp_mysql_1 exited with code 1
wordpress_1 |
wordpress_1 | Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in - o
n line 19
wordpress_1 |
wordpress_1 | Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service no
t known in - on line 19
wordpress_1 |
wordpress_1 | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
but if I removed the volumes from mysql image, then it works fine! How can I mount the volume as I need data to be persisted.

It's actually a problem with MariaDB. You cannot mount the folder for MariaDB to the host using Docker because it presents the shared files/folders permissions to the database container as root owned with writable only by root. The solution is to use docker-compose named volumes. As stated in docker documentation:
Docker has two options for containers to store files in the host machine, so that the files are persisted even after the container stops: volumes, and bind mounts. If you’re running Docker on Linux you can also use a tmpfs mount.
What you are trying to use is the bind-mount which does not works with MariaDB. So we can use docker volume for that.
When you create a volume, it is stored within a directory on the Docker host. When you mount the volume into a container, this directory is what is mounted into the container. This is similar to the way that bind mounts work, except that volumes are managed by Docker and are isolated from the core functionality of the host machine. Volumes are stored in a part of the host filesystem which is managed by Docker(/var/lib/docker/volumes/ on Linux). So change your docker-compose file as:-
version: '2'
services:
wordpress:
image: wordpress
ports:
- 8080:80
environment:
WORDPRESS_DB_NAME: my_db
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
volumes:
- ./src:/var/www/html
mysql:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: password
volumes:
- db_data:/var/lib/mysql
volumes:
db_data:
i.e. use a named volume under mysql service and declare it in top level volumes key. This will tell docker-compose to create a Docker mananged volume and your MariaDB data is backed up/persisted at /var/lib/docker/volumes/_db_data/_data directory on host machine.
Also after running docker-compose up command if you do
docker volume ls
then you can see docker-compose created volume.

Related

pymysql.err.OperationalError: (1130, '172.18.0.3' is not allowed to connect to this MariaDB server)

I have a dockerized app and use the following docker-compose.yml file:
version: '3.7'
services:
app:
restart: always
build: ./app
ports:
- "8501:8501"
env_file:
- .env
command: streamlit run Main.py
networks:
- streamlit_network
mariadb:
image: mariadb:10.5.17
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
- db_conf:/etc/mysql/conf.d
environment:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "db"
MYSQL_USER: "user"
MYSQL_PASSWORD: "password"
networks:
- streamlit_network
nginx:
restart: always
build: ./nginx
ports:
- "80:80"
depends_on:
- app
- mariadb
networks:
- streamlit_network
volumes:
db_data:
db_conf:
networks:
streamlit_network:
driver: bridge
I am able to access mysql using the following commands:
mysql -h <ip-address where database is hosted> -p -u username database
inside of my ubuntu machine which has a host IP of
How do I achieve the same within docker container
I believe '172.18.0.3' is a randomly generated ip address by docker as the IP address did change to '172.18.0.2' on another occasion.
The .env file is:
host="mariadb"
user="user"
password="password"
database="db"
port="3306"
This is the trace for mariadb when I am running docker-compose up:
mariadb_1 | 2022-10-27 12:20:24+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.9.3+maria~ubu2204 started.
mariadb_1 | 2022-10-27 12:20:25+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mariadb_1 | 2022-10-27 12:20:25+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.9.3+maria~ubu2204 started.
mariadb_1 | 2022-10-27 12:20:26+00:00 [Note] [Entrypoint]: MariaDB upgrade information missing, assuming required
mariadb_1 | 2022-10-27 12:20:26+00:00 [Note] [Entrypoint]: MariaDB upgrade (mariadb-upgrade) required, but skipped due to $MARIADB_AUTO_UPGRADE setting
mariadb_1 | 2022-10-27 12:20:26 0 [Note] mariadbd (server 10.9.3-MariaDB-1:10.9.3+maria~ubu2204) starting as process 1 ...
mariadb_1 | 2022-10-27 12:20:26 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
mariadb_1 | 2022-10-27 12:20:26 0 [Note] InnoDB: Number of transaction pools: 1
mariadb_1 | 2022-10-27 12:20:26 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
mariadb_1 | 2022-10-27 12:20:26 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
mariadb_1 | 2022-10-27 12:20:26 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
mariadb_1 | 2022-10-27 12:20:26 0 [Note] InnoDB: Completed initialization of buffer pool
mariadb_1 | 2022-10-27 12:20:26 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
mariadb_1 | 2022-10-27 12:20:27 0 [Note] InnoDB: 128 rollback segments are active.
mariadb_1 | 2022-10-27 12:20:27 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
mariadb_1 | 2022-10-27 12:20:27 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
mariadb_1 | 2022-10-27 12:20:27 0 [Note] InnoDB: log sequence number 35204; transaction id 8
mariadb_1 | 2022-10-27 12:20:27 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mariadb_1 | 2022-10-27 12:20:27 0 [Note] Plugin 'FEEDBACK' is disabled.
mariadb_1 | 2022-10-27 12:20:27 0 [Note] InnoDB: Buffer pool(s) load completed at 221027 12:20:27
mariadb_1 | 2022-10-27 12:20:27 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
mariadb_1 | 2022-10-27 12:20:28 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
mariadb_1 | 2022-10-27 12:20:28 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
mariadb_1 | 2022-10-27 12:20:28 0 [Note] Server socket created on IP: '0.0.0.0'.
mariadb_1 | 2022-10-27 12:20:28 0 [Note] Server socket created on IP: '::'.
mariadb_1 | 2022-10-27 12:20:28 0 [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
mariadb_1 | 2022-10-27 12:20:28 0 [ERROR] Missing system table mysql.roles_mapping; please run mysql_upgrade to create it
mariadb_1 | 2022-10-27 12:20:28 0 [Warning] Can't open and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live without them
mariadb_1 | 2022-10-27 12:20:28 0 [ERROR] Can't open the mysql.func table. Please run mysql_upgrade to create it.
mariadb_1 | 2022-10-27 12:20:28 0 [ERROR] Cannot open mysql.event
mariadb_1 | 2022-10-27 12:20:28 0 [ERROR] mariadbd: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
mariadb_1 | 2022-10-27 12:20:28 1 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_slave_pos' doesn't exist
mariadb_1 | 2022-10-27 12:20:28 0 [Note] mariadbd: ready for connections.
mariadb_1 | Version: '10.9.3-MariaDB-1:10.9.3+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
mariadb_1 | 2022-10-27 12:27:27 3 [Warning] Aborted connection 3 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.2' (This connection closed normally without authentication)
mariadb_1 | 2022-10-27 12:35:05 4 [Warning] Aborted connection 4 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.2' (This connection closed normally without authentication)

Invoice Ninja with docker compose - Error 500

I have setup Invoice ninja with docker-compose behind a nginx reverse proxy, which also manages the TLS certificate.
As far as I can see from the logs, everything initializes correct, but when I navigate to the site, I can only see a 500 Server error.
I provided my docker-compose and the logs until the first 500 error below.
Thanks in advance!
docker-compose.yml
version: '3.7'
services:
server:
image: caddy:alpine
restart: always
environment:
- APP_URL=http://ninja.example.de
volumes:
# Vhost configuration
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
- ./public:/var/www/app/public
- ./storage:/var/www/app/storage
depends_on:
- app
# Run webserver nginx on port 80
# Feel free to modify depending what port is already occupied
ports:
- "127.0.0.1:4301:80"
# - "443:443"
networks:
- invoiceninja
app:
image: invoiceninja/invoiceninja:5
restart: always
environment:
- APP_URL=ninja.example.de
- APP_KEY=base64:mykeyxzy
- MULTI_DB_ENABLED=false
- DB_HOST1=db
volumes:
- ./public:/var/www/app/public
- ./storage:/var/www/app/storage
depends_on:
- db
networks:
- invoiceninja
db:
image: mysql:5
restart: always
environment:
- MYSQL_ROOT_PASSWORD=mypassword
- MYSQL_USER=ninja
- MYSQL_PASSWORD=ninja
- MYSQL_DATABASE=db-ninja-01
volumes:
- ./mysql/data:/var/lib/mysql
networks:
- invoiceninja
# cron:
# cron is commented out by me
volumes:
mysql-data:
public:
storage:
networks:
invoiceninja:
docker log
server_1 | {"level":"info","ts":1590774949.786359,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
server_1 | {"level":"info","ts":1590774949.7946017,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
server_1 | {"level":"info","ts":1590774949.7968726,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
server_1 | 2020/05/29 17:55:49 [INFO][cache:0xc00075e0a0] Started certificate maintenance routine
server_1 | {"level":"info","ts":1590774949.7995124,"logger":"tls","msg":"cleaned up storage units"}
server_1 | {"level":"info","ts":1590774949.799886,"msg":"autosaved config","file":"/config/caddy/autosave.json"}
server_1 | {"level":"info","ts":1590774949.799923,"msg":"serving initial configuration"}
app_1 | Configuration cache cleared!
app_1 | Configuration cached successfully!
app_1 | Route cache cleared!
app_1 | Routes cached successfully!
app_1 | Files cached successfully!
app_1 | [29-May-2020 17:55:49] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
app_1 | [29-May-2020 17:55:49] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
app_1 | [29-May-2020 17:55:49] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
app_1 | [29-May-2020 17:55:49] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
app_1 | [29-May-2020 17:55:49] NOTICE: fpm is running, pid 1
app_1 | [29-May-2020 17:55:49] NOTICE: ready to handle connections
db_1 | 2020-05-29 17:55:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.30-1debian10 started.
db_1 | 2020-05-29 17:55:48+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1 | 2020-05-29 17:55:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.30-1debian10 started.
db_1 | 2020-05-29T17:55:48.703457Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1 | 2020-05-29T17:55:48.708189Z 0 [Note] mysqld (mysqld 5.7.30) starting as process 1 ...
db_1 | 2020-05-29T17:55:48.714931Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1 | 2020-05-29T17:55:48.714988Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1 | 2020-05-29T17:55:48.714995Z 0 [Note] InnoDB: Uses event mutexes
db_1 | 2020-05-29T17:55:48.714999Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1 | 2020-05-29T17:55:48.715002Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db_1 | 2020-05-29T17:55:48.715011Z 0 [Note] InnoDB: Using Linux native AIO
db_1 | 2020-05-29T17:55:48.715701Z 0 [Note] InnoDB: Number of pools: 1
db_1 | 2020-05-29T17:55:48.716017Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1 | 2020-05-29T17:55:48.722484Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1 | 2020-05-29T17:55:48.741778Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1 | 2020-05-29T17:55:48.747111Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1 | 2020-05-29T17:55:48.763090Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1 | 2020-05-29T17:55:48.798980Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1 | 2020-05-29T17:55:48.799233Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1 | 2020-05-29T17:55:48.832312Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1 | 2020-05-29T17:55:48.834307Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1 | 2020-05-29T17:55:48.834434Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1 | 2020-05-29T17:55:48.835099Z 0 [Note] InnoDB: Waiting for purge to start
db_1 | 2020-05-29T17:55:48.885461Z 0 [Note] InnoDB: 5.7.30 started; log sequence number 12488420
db_1 | 2020-05-29T17:55:48.886497Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1 | 2020-05-29T17:55:48.897039Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1 | 2020-05-29T17:55:48.906339Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
db_1 | 2020-05-29T17:55:48.906387Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
db_1 | 2020-05-29T17:55:48.907291Z 0 [Warning] CA certificate ca.pem is self signed.
db_1 | 2020-05-29T17:55:48.907356Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
db_1 | 2020-05-29T17:55:48.908141Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200529 17:55:48
db_1 | 2020-05-29T17:55:48.909168Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
db_1 | 2020-05-29T17:55:48.909863Z 0 [Note] IPv6 is available.
db_1 | 2020-05-29T17:55:48.909911Z 0 [Note] - '::' resolves to '::';
db_1 | 2020-05-29T17:55:48.909952Z 0 [Note] Server socket created on IP: '::'.
db_1 | 2020-05-29T17:55:48.914971Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1 | 2020-05-29T17:55:48.932266Z 0 [Note] Event Scheduler: Loaded 0 events
db_1 | 2020-05-29T17:55:48.932616Z 0 [Note] mysqld: ready for connections.
db_1 | Version: '5.7.30' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
app_1 | 192.168.48.5 - 29/May/2020:17:59:07 +0000 "GET /index.php" 500
This errors occurs dues to the facts that the application cannot correctly determine the passed application key APP_KEY. It seems the application cache is a bit reluctant to be refreshed - this is only a problem in the docker containers and not for the self-host option w/o docker.
I pushed an update to the for the latest and 5 tags. So first, please update your images. This fixes some permission to get proper write permissions to some cache folders.
Then after your docker-compose setup started please run
docker-compose exec app php artisan config:cache
a couple of times and refresh your page. It takes some time and a couple of calls till the cache is refreshed. The error message then changes to SQLSTATE[42S02]: Base table or view not found: this is a know problem but can be fixed (for now) by navigation to /setup which then will run the proper migrations.

Docker Compose LAMP Database connection error

So after running docker-compose up I get the message Error establishing a database connection when visiting http://localhost:8000/
Output of docker ps -a:
➜ ~ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5a3c015efeec dockercompose_wordpress "docker-php-entryp..." 17 minutes ago Up 16 minutes 0.0.0.0:8000->80/tcp dockercompose_wordpress_1
4e46c85345d5 dockercompose_db "docker-entrypoint..." 17 minutes ago Up 16 minutes 0.0.0.0:3306->3306/tcp dockercompose_db_1
Is this right? Or should it only show one container since wordpress depends_on db?
So I am expecting to see my Wordpress site at localhost:8000.
Had imported the database making sure I sed to change all url to point to http://localhost.
Had also mounted ./html which contains my source files to container's /var/www/html.
Did I miss anything?
Folder Structure:
Folder
|
|-db
| |-Dockerfile
| |-db.sql
|
|-html
| |- (Wordpress files)
|
|-php
| |-Dockerfile
|
|-docker-composer.yml
docker-composer.yml:
version: '3'
services:
db:
build:
context: ./db
args:
MYSQL_DATABASE: coown
MYSQL_ROOT_PASSWORD: root
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: coown
MYSQL_ROOT_PASSWORD: root
wordpress:
build:
context: ./php
depends_on:
- db
ports:
- "8000:80"
volumes:
- ./html:/var/www/html
db/Dockerfile:
FROM mysql:5.7
RUN chown -R mysql:root /var/lib/mysql/
ARG MYSQL_DATABASE
ARG MYSQL_ROOT_PASSWORD
ENV MYSQL_DATABASE=$MYSQL_DATABASE
ENV MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
ADD db.sql /etc/mysql/db.sql
RUN cp /etc/mysql/db.sql /docker-entrypoint-initdb.d
EXPOSE 3306
php/Dockerfile:
FROM php:7.0-apache
RUN docker-php-ext-install mysqli
Some output of docker-compose up:
db_1 | 2017-06-12T19:21:33.873957Z 0 [Warning] CA certificate ca.pem is self signed.
db_1 | 2017-06-12T19:21:33.875841Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
db_1 | 2017-06-12T19:21:33.876030Z 0 [Note] IPv6 is available.
db_1 | 2017-06-12T19:21:33.876088Z 0 [Note] - '::' resolves to '::';
db_1 | 2017-06-12T19:21:33.876195Z 0 [Note] Server socket created on IP: '::'.
db_1 | 2017-06-12T19:21:33.885002Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170612 19:21:33
db_1 | 2017-06-12T19:21:33.902676Z 0 [Warning] 'user' entry 'root#localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-06-12T19:21:33.902862Z 0 [Warning] 'user' entry 'mysql.sys#localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-06-12T19:21:33.902964Z 0 [Warning] 'db' entry 'sys mysql.sys#localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-06-12T19:21:33.903006Z 0 [Warning] 'proxies_priv' entry '# root#localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-06-12T19:21:33.905557Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys#localhost' ignored in --skip-name-resolve mode.
db_1 | 2017-06-12T19:21:33.910940Z 0 [Note] Event Scheduler: Loaded 0 events
db_1 | 2017-06-12T19:21:33.911310Z 0 [Note] mysqld: ready for connections.
db_1 | Version: '5.7.18' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
db_1 | 2017-06-12T19:21:33.911365Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check.
db_1 | 2017-06-12T19:21:33.911387Z 0 [Note] Beginning of list of non-natively partitioned tables
db_1 | 2017-06-12T19:21:33.926384Z 0 [Note] End of list of non-natively partitioned tables
wordpress_1 | 172.18.0.1 - - [12/Jun/2017:19:28:39 +0000] "GET / HTTP/1.1" 500 557 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
are you using "db" host to connect PHP (Wordpress? wp-config.php?) to your database instead of the usual "localhost"?.

Docker On windows10 Volume permissions " a STORAGE ENGINE failed."

This morning i try to install Docker on my laptop (windows10),
(My Docker use hyper-v)
I try to use this basic docker-compose
version: '2'
services:
mariadb:
image: mariadb
container_name: mariadb
ports:
- "3306:3306"
volumes:
- ./mysql1/:/var/lib/mysql
environment:
MYSQL_USER : root
MYSQL_ROOT_PASSWORD: root
I have some error on running :
docker-compose up
Creating mariadb
Attaching to mariadb
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] mysqld (mysqld 10.1.22-MariaDB-1~jessie) starting as process 1 ...
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] InnoDB: The InnoDB memory heap is disabled
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] InnoDB: Compressed tables use zlib 1.2.8
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] InnoDB: Using Linux native AIO
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] InnoDB: Using SSE crc32 instructions
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] InnoDB: Initializing buffer pool, size = 256.0M
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] InnoDB: Completed initialization of buffer pool
mariadb | 2017-04-04 8:29:00 140557637724096 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 0 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
mariadb | 2017-04-04 8:29:00 140557637724096 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
mariadb | 2017-04-04 8:29:00 140557637724096 [ERROR] Plugin 'InnoDB' init function returned error.
mariadb | 2017-04-04 8:29:00 140557637724096 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mariadb | 2017-04-04 8:29:00 140557637724096 [Note] Plugin 'FEEDBACK' is disabled.
mariadb | 2017-04-04 8:29:00 140557637724096 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
mariadb | 2017-04-04 8:29:00 140557637724096 [ERROR] Unknown/unsupported storage engine: InnoDB
mariadb | 2017-04-04 8:29:00 140557637724096 [ERROR] Aborting
mariadb |
mariadb exited with code 1
after running my directory ./mysql1/ and subfile was created :
C:\USERS\--------\DOCUMENTS\DOCKER\MARIADB\MYSQL1
| aria_log.00000001
| aria_log_control
| ibdata1
|
\---mysql
Yes I know that it's about my volumes (something about permissions or access or ...)
I have no ideas how solve it.
I was experiencing the same issue and the only way I could figure out how to resolve this was to delete the MARIADB\MYSQL1 folder. Yes, I lost all of the database records from all of my development sites, but for me, it was all test information anyway so no real data was lost.
After I deleted the MYSQL1 folder, I ran:
docker-compose build --no-cache MariaDB
Then I started up the container:
docker-compose up -d mariadb
The error finally went away and I was able to use my MariaDB container again. Hope this helps someone in the future!

Docker-compose cannot start mysql, permission denied to /tmp

I'm trying to start a docker container from the vanilla mariadb image from docker hub using docker-compose. While everything previously worked, I'm now getting the error message Can't create/write to file '/tmp/ibLTxiq7' (Errcode: 13 "Permission denied"). Here's the full log:
139707238336448 [Note] /usr/sbin/mysqld (mysqld 10.1.14-MariaDB-1~jessie) starting as process 51 ...
139707238336448 [Note] InnoDB: Using mutexes to ref count buffer pool pages
139707238336448 [Note] InnoDB: The InnoDB memory heap is disabled
139707238336448 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
139707238336448 [Note] InnoDB: Memory barrier is not used
139707238336448 [Note] InnoDB: Compressed tables use zlib 1.2.8
139707238336448 [Note] InnoDB: Using Linux native AIO
139707238336448 [Note] InnoDB: Using SSE crc32 instructions
139707238336448 [ERROR] mysqld: Can't create/write to file '/tmp/ibLTxiq7' (Errcode: 13 "Permission denied")
7f10205047c0 InnoDB: Error: unable to create temporary file; errno: 13
139707238336448 [ERROR] Plugin 'InnoDB' init function returned error.
139707238336448 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
139707238336448 [ERROR] Unknown/unsupported storage engine: InnoDB
139707238336448 [ERROR] Aborting
I don't understand, does the /tmp folder in the log refer to the host machine or the container? How would I fix this issue?
The command I'm trying to run (as root user) is docker-compose up db. I've checked that there indeed is space on the disk. My OS Ubuntu 16.04.
Update: My docker-compose.yml-file
https-portal:
image: steveltn/https-portal
ports:
- '80:80'
- '443:443'
links:
- wordpress
restart: always
environment:
DOMAINS: 'domain.com -> http://wordpress'
STAGE: 'production'
wordpress:
image: wordpress
links:
- db:mysql
volumes:
- ~/wordpress/wp_html:/var/www/html
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: [---]
Update 2:
I seem to have (at least temporarily) solved the problem, rather surprisingly, by adding a volume mount path for the db container:
db:
image: mariadb
volumes:
- /data/maridb:/var/lib/mysql
However this does not actually affect anything, it just prints a warning that the volume mount is not used (and indeed it isn't) because the container has previously been created with a different volume and the old one is used. Still, the original problem disappears. Any thoughts on what causes this behavior?

Resources