Here are some notes about working with Docker. On my Raspberry Pi I need to run all commands as sudo
.
First of all, do not confuse the different terms. An image is like a blueprint that serves to generate containers. The containers are then the actual instance that you can start or stop.
List images
docker images
List containers
- Show the running containers:
docker ps
- Show all containers:
docker ps -a
- Use the
container
command. I don’t know it it differs from theps
command above. The output seems to be the same.
docker container ls
Start a container
- List the available containers (see above)
- Get the container ID to start
- Run
docker start [Container ID]
e.g.
docker start 725dc751823b
Exit a container without stopping it
If started a container with the docker run
options -i
and -t
, you can detach from it and leave it running:
- Press
[Ctrl]
+[p]
followed by[Ctrl]
+[q]
Connect/attach to a running container
docker attach [Container ID]