I have simple container with some service.
When I restarting server without stopping this container, I can't start it again.
Error message is:
pidfile found, try stopping another running service or delete /var/run/service.pid
I know that I can
rm -f /var/run/service.pid && original_entrypoint.shBut I want simply do something like
docker rm_file container:/var/run/service.pid; docker start container
Because it is most simple and fast to start solution.
Isn't here is no way to access container's fs without completely rebuild it? This operation is looking so useful...
Answering by myself using hints from another answer
Find where directory stored on docker host:
export LOCAL_DIR=$(docker inspect -f '{{ .GraphDriver.Data.UpperDir }}' container_name)
Remove file locally:
sudo rm -f ${LOCAL_DIR}/run/service.pid
Run container:
docker start container_name
Or all in one:
sudo rm -f "$(docker inspect -f '{{ .GraphDriver.Data.UpperDir }}' container_name)/run/service.pid" && docker start container_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With