Docker – First steps and basic commands

As i have to use docker, i decided to write this (mostly for myself) to be able to look up useful docker things.

I got them from – so visit there for more details!


Images: The blueprint and environment for containers

Containers: Are created from images with run and are the processes of the images (so to speak)


#install container
docker pull $containername

#run container
docker run $container
docker run -d $container #detached
docker run -P $container #attach internal ports to random (outside) ports

##mostly used:
docker run -d -P --name $customname $container

#run container with terminal
docker run -it $container sh

#show containers
docker ps -a

#show used ports
docker port $customname

#stop containers
docker stop $customname #or container id

#delete exited containers (caution)
docker container prune

#show local images
docker images