You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to build an image and start a container from that image
# Build an image from a Dockerfile
> docker build -t <image_name> .
# List images
> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<image_name> latest 47da5935a6e9 11 minutes ago 910MB
...
# Run a command in a new container
> docker run <image_name>
# OR in interactive mode
> docker run -i -t <image_name> /bin/bash
You can use other ways to specify an image
<REPOSITORY> docker will automatically run image with 'latest' tag
<REPOSITORY>:<TAG>
<IMAGE ID>
Purging all Images, Containers, Volumes, and Networks
# clean up any resources — images, containers, volumes, and networks — that are dangling
> docker system prune
# To additionally remove any stopped containers and all unused images
> docker system prune -a
# delete container
> docker stop <container_id>
> docker rm <container_id>
# delete image
> docker rmi <image_id>