Can I modify the FS in a stopped container?


I am using the andypetrella/spark-notebook image which starts a Play server at startup. But if the container was stopped, I cannot start the container. I think it is because the container try to start a Play server again, but it got

This application is already running (Or delete /opt/docker/RUNNING_PID file).

and stopped again. I have to create a new container every time if it stopped…very annoying.


It’s just a questionably designed image. It spawns a pidfile on start but then refuses to start back up because said pidfile exists. Containers shouldn’t really be doing their own process management unless absolutely necessary (now, you might want to run init in a container, which is a somewhat different use case). Most likely it should be cleaning up that pidfile on SIGTERM or not creating it at all. I’d suggest revising the image to account for this, probably dropping the use of pidfile if possible or at least scripting entrypoint to get rid of it.

Yeah~I think it is a problem of the image too. But its maintainer is not
responding to my question, so I am looking for workaround.

For workaround you could make an image which has FROM the original image and the ENTRYPOINT is a shell script which deletes the pid file if it exists. That will take care of the issue, but you really should build your own image so you know exactly what it contains (and also you aren’t left dealing with consequences of upstream like this one).