Use the docker run command to run the container, and then enter the container and report an error
run container command
docker run --restart=always --name mongo -v /data/mongo:/data/db -p 27017:27017 -d mongo --auth
Enter the container command
docker exec -it mongo bash
error message
Error response from daemon: Container 90831dd80b32a1502d9535c874ceec899b5fd70c883481195b4f36cd29be47b0 is restarting, wait until the container is running
[root@Tracy ~]# docker exec -it mongo bash
Error response from daemon: Container 90831dd80b32a1502d9535c874ceec899b5fd70c883481195b4f36cd29be47b0 is restarting, wait until the container is running
analyze
(1) Check whether the container is started
[root@Tracy ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
90831dd80b32 mongo "docker-entrypoint.s…" About a minute ago Restarting (14) 20 seconds ago mongo
starting, but no ports
(2) Check whether the port is occupied
[root@Tracy ~]# lsof -i:27017
port not in use
(3) View docker logs
docker logs --tail 50 --follow --timestamps mongo # mongo is the container name
There is an error message saying: There is no space on the disk
(4) View disk space
you -ach / --max-depth=1
[root@Tracy ~]# du -ach / --max-depth=1
0 /sbin
0 /lib
8.7G /var
0 /sys
4.0K /media
4.0K /srv
0 /.autorelabel
176M /boot
du: cannot access ‘/proc/23839/task/23839/fd/4’: No such file or directory
du: cannot access ‘/proc/23839/task/23839/fdinfo/4’: No such file or directory
du: cannot access ‘/proc/23839/fd/3’: No such file or directory
du: cannot access ‘/proc/23839/fdinfo/3’: No such file or directory
0 /proc
7.0G /usr
4.0K /mnt
16K /lost+found
16K /opt
59M /tmp
0 /dev
0 /lib64
39M /etc
179M /run
109M /data
3.4G /home
264M /root
0 /bin
20G /
20G total
The total disk space is 20G, all of which are full, just clear or expand the disk space.