How to get into a not running docker container
In general, you just have to replace the ‘entrypoint’ script to let the container running again, then you get in to do some operations.
Here I’m going to talk about another solution, which will use ‘docker-compose’:
#new_entrypoint.sh
sleep 1000
#docker-compose.yaml
version: '3.3'
services:
node-test:
image: node:14-buster-slim
entrypoint: "sh /new_entrypoint.sh"
volumes:
- ./new_entrypoint.sh:/new_entrypoint.sh
docker-compose up -d
#docker ps
docker exec -it --user=root ba6ada2d75d3 /bin/sh
docker run --rm -it --entrypoint /bin/sh <image_id>
#bash