MySQL on Docker failing to start

Currently reading
MySQL on Docker failing to start

4
0
NAS
DS218+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
When trying to run MySQL on Docker (on my Synology server), I have specified the stack.yml location like this:

stack_yml.jpg


Its contents are:

# Use root/example as user/password credentials
version: '3.1'

services:

db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: myPass123

adminer:
image: adminer
restart: always
ports:
- 8081:8080

I am able to start the Docker, but after a short time it stops. The logs show:

You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD

Am I referencing the file incorrectly, are the contents of the file incorrect, or am I doing something else wrong?

I am using the official MySQL Docker image I'm using is Docker Hub version 5.7.32
 

Shadow

Subscriber
607
208
NAS
DS216+II, DS118, DS718+
Router
  1. RT2600ac
  2. MR2200ac
Operating system
  1. Windows
Mobile operating system
  1. Android
Shouldnt the mysql root password be set via environment variables?
 
Why would you mount a docker-compose.yml using a volume?
I sense a lot of potential for confusion here...

Also this is not a valid docker-compose.yml, as all the required indentions to make it a valid docker-compose.yml are missing....

Do you mind to elaborate on what you try to do, and what actions you took to try to make it run? You initial post does not make much sense...
 
4
0
NAS
DS218+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
It's my first time using Docker, so I might be confused :)

I want to set up 2 Dockers:
1) PrestaShop (Docker Hub)
2) MySQL (Docker Hub)

I'm setting up the MySQL Docker first.

The instructions say:

Example stack.yml for mysql:

# Use root/example as user/password credentials
version: '3.1'

services:

db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: example

adminer:
image: adminer
restart: always
ports:
- 8080:8080

So to me it looks like the configuration (including the root password) should be held within a configuration file stack.yml.

I'm thinking the issue is with Mount Path I've defined...

All I've done so far is download the image and launch it with the stack,yml file and mapping I detailed in my original post.
 
Did you create a docker-compose.yml file on your NAS, connect via SSH to a shell terminal, become root, change to the folder where your docker-compose.yml is stored and execute docker-compose up -d?

If this is not the case, please write a detailed description of your steps, preferably with screenshots if you used the UI.. if you used the shell, the exact commands.

Your docker-compose.yml still lacks all required indentions. The compose declarations you pasted are basicly invalid.
 
4
0
NAS
DS218+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
I did it all via the Synology Docker GUI. I've documented everything here Installing MySQL 5_7_32 Docker on Synology.docx

The stack.yml does have the required indentation, it just didn't format properly on this website, I have included it in my document. I wrote the file in Windows Notepad, copied it from Windows to a location on the Synology file system, then used Synology File Station to move it to the required location under /docker.

I still think the issue with the 'Mount path' setting (within the 'Volume' configuration), but it might also be something else I've done wrong 😊
 
Now I get where you confusion commes from:
The headline of what you copied and call stack.yml is intended to be used with these command line tools:

... via docker stack deploy or docker-compose


Synology provides docker-compose on the command line! You either use the docker-compose approach with the docker-compose.yml declaration OR the ui. Both methods do not mix and mingle! Though, you will be able to manage containers, created with docker-compose in Syno's docker ui.

So bacily you did mount an unrelated file to a location in the conatiner where nothing uses it. Basicly you started the mysql container without any parameters and mapped volumes. Trust me, this is not what you want.

All -e KEY=value params from the dockerhub description translate to an entry in the "Environment" tab, where the key (left hand side before the = character) needs to be entered in "variable" and the value (right hand side after the = character) in "value". Write the KEY exactly as written in the description, only modify the content of the value (unless the description points out why not)

All -v /host/path:/container/path params from the dockerhub description translate to an entry in the "Volume" tab, where the /host/path (left hand side before the : character) can be picked using the buttons "Add File" (will map single file from host to container) and "Add Folder" (will map a folder from host to container). You are free to select what file or folder you want to map, its completly up to you. Write the /container/path into "Mount Path" exactly like written in the description (uness you know exactly why you want/need it differently).

If you map the -e and -v params from the description to the Syno Docker UI. You should be good. Though one more thing: you will need to establish a link in the "Links" tab on the PrestaShop container to link it with the Mysql Container. This wouldn't be necessary when docker-compose and the yml file approach would be used.
 
4
0
NAS
DS218+
Operating system
  1. Linux
  2. Windows
Mobile operating system
  1. Android
Ah, I see! Thank you very much for the detailed answer (y)
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Similar threads

Similar threads

Trending threads

Top