In this tutorial we'll look at the basics of creating containers
docker run hello-world
docker run -it ubuntu bash
-t : Allocate a pseudo-tty
-i : Keep STDIN open even if not attached
docker run -d -p 8080:80 nginx
-d=false: Detached mode: Run container in the background, print new container id
-p=[] : Publish a container's port or a range of ports to the host
format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
Both hostPort and containerPort can be specified as a
range of ports. When specifying ranges for both, the
number of container ports in the range must match the
number of host ports in the range, for example:
-p 1234-1236:1234-1236/tcp
When specifying a range for hostPort only, the
containerPort must not be a range. In this case the
container port is published somewhere within the
specified hostPort range. (e.g., `-p 1234-1236:1234/tcp`)
(use 'docker port' to see the actual mapping)
docker ps
docker stop CONTAINER_ID