I have a docker container running ubuntu and a simple node express site.
I connected to the container as follows
docker run -i -t -p 8080:3000 node-express
The node app in the container is running with pm2, so it continues once I exit out of the container.
CONTAINER ID IMAGE
f32de2737e80 node-express:latest
Now assume I want to make an update to my app.
I assume I need to connect to the container, stop the node app, and make an update, e.g. git pull
then restart it.
My first question is how do I reconnect to this container?
Another question I have, Is this a normal approach for updating a running container in production?
You can consider
docker exec
to open a bash in your running container.See also "difference between docker attach and docker exec"
But as commented, updated the app should be done by modifying a Dockerfile and rebuilding an image.