Reputation: 2616
I today deployed an instance of MediaWiki using the appcontainers/mediawiki docker image, and I now have a new problem for which I cannot find any clue. After trying to attach to the mediawiki front container using:
docker attach mediawiki_web_1
which answers Terminated
on my configuration for a reason I ignore, trying also:
docker exec -it mediawiki_web_1 bash
I do get something close to an error message:
Error response from daemon: Container 81c07e4a69519c785b12ce4512a8ec76a10231ecfb30522e714b0ae53a0c9c68 is restarting, wait until the container is running
And there is my new problem, because this container never stop restarting. I can see that using docker ps -a
which always returns a STATUS of Restarting (127) x seconds ago
.
The thing is, I am able to stop the container (I tested) but starting it again seems to bring it back into its restarting loop.
Any idea what could be the issue here ? The whole thing was properly working until I tried to attach to it...
I am sad :-(
Upvotes: 232
Views: 499187
Reputation: 9
The same happened to me after rebooting a server. After checking the logs the cause was not clear. The issue was solved with the following steps:
docker stop <CONTAINER_ID>
docker container rm <CONTAINER_ID>
docker-compose start
Upvotes: -1
Reputation: 1059
I got the same issues originally. At first, I think there is an error happened while running container, but nothing is wrong. Finally I figure it out, it's just the container exit automatically when its routine is done. So... just add a simple command in the ending line of entrypoint.sh:
tail -f /dev/null
then the container will keep running after started. Good luck! :)
Upvotes: 0
Reputation: 41
I deleted all folders inside the dockers folder and rebuild all images again, its works for me.
docker-compose up -d --build
and
docker-compose up -d
Upvotes: 1
Reputation: 602
I Had this issue because I was in a docker swarm try:
docker swarm leave --force
Upvotes: 16
Reputation: 1
I fixed this on my pi4, without understanding how.
emby/embyserver_arm32v7:latest - kept restarting, whether I stopped, removed restarted container, used :beta
Tried then with ghcr.io/linuxserver/docker-emby/emby:arm32v7-version-4.6.0.3
It didn't keep restarting, but it didn't work either.
stop, rm, then retry with emby/embyserver_arm32v7:latest - now it works.
No idea why.
docker run -d --restart unless-stopped --volume /path/to/programdata:/config --volume /mnt/mydrive:/mnt/share1 --publish 8096:8096 --publish 8920:8920 --env UID=1000 --env GID=100 --env GIDLIST=100 ghcr.io/linuxserver/docker-emby/emby:arm32v7-version-4.6.0.3
Upvotes: 0
Reputation: 778
I had forget Minikube running in background and thats what always restarted them back up
Upvotes: 1
Reputation: 125
I just tested and removed --restart always and its works for me.
Upvotes: 0
Reputation: 442
I had the same problem for a bit after deploying the code to the prod server after a long period of running it in dev
the problem was that in my docker-compose.yml
file I didn't specify a tag for the mongo image, by default it pulled the latest, and since I wanted to keep the data path there was a mismatch between mongo versions
on dev it was 4.4.3 and in prod it pulled the latest (i guess 5.x)
the solution for me was to specify the image as mongo:4.4.3
instead of just mongo
I didn't want to go down the path of upgrading the DB
Upvotes: 3
Reputation: 31
Check the partition where you have installed docker. In most cases, the partition is at 100% capacity so you may need to look into that.
Upvotes: 0
Reputation: 9
try running
docker stop CONTAINER_ID
&
docker rm -v CONTAINER_ID
Thanks
Upvotes: -3
Reputation: 2415
In my case i removed
Restart=always
added
tty: true
And executed the below command to open shell (daemon process, because docker reads the compose file and stops the container once it reaches the last line of the file).
docker-compose up -d
Upvotes: 20
Reputation: 297
First check the logs why the container failed. Because your restart policy might bring your container back to running status. Better to fix the issue, Then probably you can build a new image with/without fix. Later execute below command
docker system prune
https://forums.docker.com/t/docker-registry-in-restarting-1-status-forever/12717/3
Upvotes: 2
Reputation: 11098
This could also be the case if you have created a systemd
service that has:
[Service]
Restart=always
ExecStart=/usr/bin/docker container start -a my_container
ExecStop=/usr/bin/docker container stop -t 2 my_container
Upvotes: 8
Reputation: 452
In my case nginx container was keep on restarting , I checked logs of nginx container and came to know .crt and .key file of a unrequired domain are having errors , so I removed respective .conf file , .crt and .key and then restarted nginx . That's it nginx is working fine without restarting .
Upvotes: 2
Reputation: 1289
When docker kill CONTAINER_ID
does not work and docker stop -t 1 CONTAINER_ID
also does not work, you can try to delete the container:
docker container rm CONTAINER_ID
I had a similar issue today where containers were in a continuous restart loop.
The issue in my case was related to me being a poor engineer.
Anyway, I fixed the issue by deleting the container, fixing my code, and then rebuilding and running the container.
Hope that this helps anyone stuck with this issue in future
Upvotes: 47
Reputation: 427
tl;dr It is restarting with a status code of 127
, meaning there is a missing file/library in your container. Starting a fresh container just might fix it.
Explanation:
As far as my understanding of Docker goes, this is what is happening:
127
, which is explained in this answer. no
(the default), (using either the command line flag --restart
or the docker-compose.yml
key restart
) while starting the container.Solution: Something might have corrupted your container. Starting a fresh container should ideally do the job.
Upvotes: 10
Reputation: 74670
The docker logs
command will show you the output a container is generating when you don't run it interactively. This is likely to include the error message.
docker logs --tail 50 --follow --timestamps mediawiki_web_1
You can also run a fresh container in the foreground with docker run -ti <your_wiki_image>
to see what that does. You may need to map some config from your docker-compose
yml to the docker
command.
I would guess that attaching to the media wiki process caused a crash which has corrupted something in your data.
Upvotes: 362
Reputation: 832
From personal experience it sounds like there is a problem within your docker container that is not allowing it to restart. So some process within the container is causing the restart to hang or some process is causing the container to crash on start.
When you start the container make sure you start it detached "-d" if you are going to attach to it. (ex. "docker run -d mediawiki_web_1")
Upvotes: 6