1

I'm trying to add mysql to a docker compose file, but every time it gives me the error some_name exited with code 0. I tried diffent configurations and even took the following config from the docker docs:

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

services:

  db:
    image: mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example

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

In this case adminer works but mysql doesn't.

My config:

mysqldb:
    image: mysql
    container_name: ${MYSQL_HOST}
    env_file:
      - ".env"
    environment:
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    ports:
      - "8989:3306"

Both my config and that from the docker docs keep giving me the same error. Although any other services are working fine. Any ideas?

1 Answer 1

1

How unfortunate. After hours I deleted my mysql image and after that everything worked fine.

Sign up to request clarification or add additional context in comments.

1 Comment

some do docker image prune -a -f after each docker-compose up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.