Pull
Download an image from DockerHub.
docker image pull ubuntu:latest
docker image ls
# REPOSITORY TAG IMAGE ID CREATED SIZE
# ubuntu latest d2e4e1f51132 8 days ago 77.8MB
Start a new container.
docker container run -it ubuntu:latest /bin/bash
root@2b180477ee63:/ ps -elf
# F S UID PID TIME CMD
# 4 S root 1 00:00:00 /bin/bash
# 0 R root 11 00:00:00 ps -elf
Exit container without terminating it.
# Ctrl-PQ
root:~/$ ps
# PID TTY TIME CMD
# 11626 pts/0 00:00:00 bash
# 31569 pts/0 00:00:00 ps
# See running containers
root:~/$ sudo docker container ls
# CONTAINER ID IMAGE COMMAND NAMES
# 2b180477ee63 ubuntu:latest "/bin/bash" nostalgic_lewin
# Make a new connection to container
docker container exec -it nostalgic_lewin bash
root@2b180477ee63:/#
# Stop and kill the container
docker container stop nostalgic_lewin
docker container rm nostalgic_lewin
docker container ls -a
Last update: 370 days ago