Some docker commands

Here are some useful docker commands:

Definitions: 
  - docker image: a binary file
  - docker container: a process running  an image

$ docker image ls
$ docker images
  show images

$ docker ps 
  show running containers
$ docker ps -a
  show all containers

$ Ctrl-p Ctrl-q
  leave the container

$ docker exec -ti -u hasylab -e USER=hasylab ctemp /bin/bash
  execute bash in a running container

$ docker restart ctemp
  restart an exited container, connect to it with attach
$ docker attach ctemp

$ docker rm ctemp
  remove the container

$ docker rm $(docker ps -a -q)
  remove all container

$ docker rmi tkracht56/hasylab 
$ docker rmi 4e58590b41b1
  remove images  

$ docker rmi $(docker images -q)
  remove all images