Docker

Veelgebruikte docker commando's.

CommandDescription
docker versionDoes Docker work?!
docker run learn/tutorial echo "hello world"Run the command echo "hello world" in tutorial.
docker run learn/tutorial ps -lCheck out the processes in the container.
docker run -t -i ubuntu /bin/bashStart a shell in the ubuntu container.
docker exec -ti {HASH} /bin/bashConnect to a running container.
docker run –d {imagename}Run container in background
docker build -t {imagename} .Build a new image from the Dockerfile in the current directory.
docker imagesList all your local images.
docker psList all your running containers.
docker ps -aList all your containers.
docker inspect {HASH}Show the properties of a docker container
docker stop {HASH}Stop a docker container
docker exec -ti {HASH} {COMMAND}Start an interactive session with a container and start a command (i.e. bash)
docker rmi {HASH}Remove an image.
docker rm {HASH}{NAME}
Remove a container.docker rm $(docker ps -aq)
Remove all containers.docker volume inspect dockermail_maillogs
Find where docker has installed folder dockermail_maillogsdocker info

Docker-compose

CommandDescription
docker-compose up –dStart multiple containers defined in de docker-compose.yml file
docker-compose stopStop multiple containers defined in de docker-compose.yml file
docker-compose rmRemove multiple containers defined in de docker-compose.yml file

Docker Machine

CommandDescription
docker-machine lsShow the virtualboxes, also with the URL’s
docker-machine envShow the environment variables, can be used to set the environment vars (see last line)
Docker-machine sshLog in to the virtual box where docker runs with a ssh connection.

Advanced

Get the shell on the current running docker:

docker exec -ti `docker ps -q /bin/bash

Error

Error with "No such image:" in docker-compose. An old cache issue.

docker-compose rm will probably solve the error.

Certificate signed by unknown authority

In Linux:

  • Create a folder /etc/docker/certs.d
  • In that folder: servername.com:portnumber
  • Create a file ca.crt with the certificate of that server.