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?
How unfortunate. After hours I deleted my mysql image and after that everything worked fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.