V
V
vrazbros2019-04-21 23:19:11
Docker
vrazbros, 2019-04-21 23:19:11

How to rebuild docker container with new settings?

Here is the content of docker-compose.yml:

version: '3.1'

services:

  db:
    build: ./db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example     

  adminer:
    build: ./adminer
    restart: always
    ports:
      - 5080:8080

Then I changed the password for the database to 123456
version: '3.1'

services:

  db:
    build: ./db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 123456     

  adminer:
    build: ./adminer
    restart: always
    ports:
      - 5080:8080

I rebuild the services:
docker-compose build
and run docker-compose up
but the password doesn't change! how to change it and why build does not help?
I also did this: docker-compose up --force-recreate db but the result is the same, the previous settings remain...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheRonCronix, 2019-04-22
@TheRonCronix

https://hub.docker.com/_/mysql:
"If you start your mysql container instance with a data directory that already contains a database (specifically, a mysql subdirectory), the $MYSQL_ROOT_PASSWORD variable should be omitted from the run command line; it will in any case be ignored, and the pre-existing database will not be changed in any way."

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question