Docker Community Forums

Share and learn in the Docker community.

Mysql container only with status "Restarting"


#1

Hi, I’m Danilo Martins, I’m working with Docker and I have a Mysql database container, I installed it as docker-composer below but my mysql container is only in Restarting mode. I do not know what to do anymore …

version: ‘2’
services:
db:
image: mysql:5.7
volumes:
- “./data:/var/lib/mysql”
restart: always
ports:
- “8081:3306”
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mydb
MYSQL_USER: root
MYSQL_PASSWORD: root

web:
    volumes:
        - "./src:/var/www/html"
    depends_on:
        - db
    image: danilomartinspacs/devback
    links:
        - db
    ports:
        - "8000:80"
    restart: always

(Paulxroot) #2

Hi Danilo Martins,

I guess that there is a problem inside your DB container, that makes the mysql process stop. That causes the container to shutdown. Because of ‘restart: always’, it always tries to restart again.

To find the problem you can:
docker logs -f <db_container_name>
This will give you the logs of this container, probably including what mysql is doing and its errors. If you need help interpreting the logs, you could post them here. I hope I can come back to your problem.


#3

yes, or run docker-compose up

so without the -d

which will throw errors directly at you