I am quite new to Docker and I have run into a problem. The basic thing I'm trying to do, is to connect a java service to a mysql database.
The setup is that I have one Dockerfile for the service, and a separate one for mysql. Then I'm connecting these through a docker-compose file.
The Dockerfile for the database copies a db dump into the container, but it's not working when I check it in mysql workbench (or sequel pro). Both containers are up and running.
I have created a new user in workbench called dbuser with the right password. But this user is not granted access to create this database.
I had problems with the passwords in workbench earlier on, and got passed them by changing the mysql image from :latest to :5.7.
I can connect to localhost:3307 in Workbench but there is no database there.
The dump grants all access to my dbuser. I have inspected the container and the image so I know the dump is in there. But it seems like Docker never get to the point of running the dump, and I suspect that this is due to something I have done wrong.
All help is very appreciated!
Dockerfile for db
FROM mysql:5.7
ENV MYSQL_ROOT_PASSWORD=root
ENV MYSQL_ALLOW_SECRET_PASSWORD=yes
COPY Dump20180430.sql /docker-entrypoint-initdb.d
docker-compose
version: '3.4'
services:
productservicejava:
image: productservicejava
build:
context: .
dockerfile: Dockerfile
depends_on:
- db
ports:
- "8080:8080"
db:
image: productservicedb
build:
context: .
dockerfile: DockerfileDb
ports:
- "3307:3306"
Edit: adding part of the log from running the db container. No errors but some warnings.
db_1 | 2018-05-24T12:13:38.522966Z 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 | 2018-05-24T12:13:38.524314Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-24T12:13:38.524363Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-24T12:13:38.524377Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-24T12:13:38.524412Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-24T12:13:38.524419Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-24T12:13:38.524432Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-24T12:13:38.527659Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-24T12:13:38.527679Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.