Category Archives: CLI

Docker

Reference

Commanddescription
systemctl start docker
systemctl status docker
systemctl stop docker
docker info
docker version
start docker
view docker process status
stop docker
view docker info
view docker version
docker images
docker image ls
docker search ubuntu
docker pull ubuntu
docker rmi ubuntu
docker image rm
view image list
view image list ( > v1.13)
search for an image
download an image
delete an image
delete an image ( > v1.13)
docker ps -a
docker ps -l
docker container ls
docker container rm <cid>
docker rm <cid>
view running containers
view all containers
view containers ( > v1.13)
delete container with id <cid>
delete container with id <cid>
docker run imagename
docker run –name bla imagename
docker run -it ubuntu
docker start <cid>
docker stop <cid>
docker stop $(docker ps -q)
docker stats <cid>
docket top <cid>
docker kill<cid>
create and run a container
create and run a named container
create interactive session
start an existing container
stop a container
stop all running containers
view running stats of a container
view top stats of a container
kill a running container
docker attach <cid>
docker exec -it ubuntu bash
reconnect to a running container
Open a new terminal window

How to detach

How container was startedhow to detach
-t and -i is used to launch the containerctrl + P and then ctrl + Q
-t is used to launch the containerctrl + C
otherwisepkiill

Examples

sudo docker run --detach \
  --hostname gitlab.example.com \
  --publish 443:443 --publish 80:80 --publish 22:22 \
  --name gitlab \
  --restart always \
  --volume /srv/gitlab/config:/etc/gitlab \
  --volume /srv/gitlab/logs:/var/log/gitlab \
  --volume /srv/gitlab/data:/var/opt/gitlab \
  gitlab/gitlab-ce:latest

References: