Having started to use docker recently, some of the commands that are needed are a bit difficult to remember. I’m sure that this will change the more that I use it, but as a quick reminder/look up for this initial phase, I’m just going to list some of them here.
List current images:
sudo docker images
List currrent running containers:
sudo docker ps
Saving the state of a container by using the id from above command:
sudo docker commit -m "latest state comment" -a "John Somebody" 7ed30_id_no new_name_of_container:v2
Starting a container with port forwarding:
sudo docker run -p 8000 -t -i new_name_of_container:v2 /bin/bash
Sharing a directory from the host system (/home/user/Prog) inside the container (Prog):
sudo docker run -p 8000 -v /home/user/Prog:/Prog -t -i new_name_of_container:v2 /bin/bash