# run a container "nginx"
docker container run --publish 80:80 --detach --name webhost nginx
# it will return a container ID, use it to stop or remove container
6903032478...
# run in the background
-d / --detach
# open up port 80 on host, forward to port 80 in container
-p / --publish 80:80
# name a container
--name webhost
# list containers (running or all)
docker container ls
docker container ls -a
docker ps
docker ps -a
# run vs start: run always init new container, "start" an existing container
docker container start 690
# stop a container by ID (first 3 letters) or name
docker container stop 690
docker container stop webhost
# read logs of a container (by name of id)
docker container logs webhost
# read processes of a container
docker container top webhost
THIS IS IMPORTANT, A PROCESS RUN BY A CONTAINER IS A REAL PROCESS, JUST JUST A VM
# remove a container (use -f to force remove), multiple containers by space
docker container rm 690 abc xuz
docker container rm -f 690
# get help
docker container --help