Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart Issues #1

Open
normtomlins opened this issue Feb 23, 2019 · 1 comment
Open

Restart Issues #1

normtomlins opened this issue Feb 23, 2019 · 1 comment

Comments

@normtomlins
Copy link

Hi,

When you create the container for the first time, it will create the required directory using this command from the run-always script.

mkdir -p /var/run/mysqld

But, if you do a docker-compose down and then issue a docker-compose up, this directory doesn't get created again and mysqld won't start.

As the run always has this line before shown below before the mkdir -p /var/run/mysqld

if [ -f /data/mysql.configured ]; then
exit 0
fi

The issue is I map the data directory to the host and the mysql.configured is always true.

Please see the attached docker-compose.yml file.

version: '3.6'
services:
db:
image: nimmis/alpine-mariadb
volumes:
- db_data_test:/data
restart: always
env_file:
- .env
environment:
MARIADB_REMOTE_ROOT: 1
MARIADB_ROOT_PASSWORD: 1password1
MARIADB_DATABASE: mydatabase
MARIADB_USER: myuser
MARIADB_PASSWORD: 1myuserpassword
ports:
- "3306:3306"

  networks:
     - frontend

  healthcheck:
    test: ["CMD-SHELL", 'mysqladmin ping']
    interval: 10s
    timeout: 2s
    retries: 10
@nimmis
Copy link
Owner

nimmis commented May 16, 2019

I did the following

run the following command

docker volume create db_data_test
to create the volume

the used this modified version of your docker-compose.yml (removed som local defined option, BUT added the volume definition)

version: '3.6'
volumes:
  db_data_test:
services:
  db:
    image: nimmis/alpine-mariadb
    volumes:
      - db_data_test:/data
    restart: always
    environment:
      MARIADB_REMOTE_ROOT: 1
      MARIADB_ROOT_PASSWORD: 1password1
      MARIADB_DATABASE: mydatabase
      MARIADB_USER: myuser
      MARIADB_PASSWORD: 1myuserpassword
    ports:
      - "3306:3306"

docker-compose up and down works, with the data in the datavolume db_data_test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants