Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 15, 2020 04:08 am GMT

Docker for Beginners - By Beginner

Hello world,

I have been learning Docker . I wanted to share some basics command to get started as a developer, I hope you know the basics about What is docker, containers or virtualization?

I am using Windows 10 2004 Update , this update comes with WSL2. In this tutorial, I am using Ubuntu on WSL2.

Information

Show all commands

$ docker

Docker

Docker version

$ docker version

Show information like number of containers

$ docker info

Containers

Create and run a container in foreground

docker container run -it -p 80:80 nginx

Run a container in foreground

Create and run a container in background

$ docker container run -d -p 80:80 nginx

Run in background

Running container

Running

Naming containers

$ docker container run -d -p 80:80 --name nginx-proxy nginx

List running containers

$ docker container ls

Running all containers

List all containers

$ docker container ls -a

Stop container

$ docker container stop [ID]

Stop container

Stop all containers

$ docker stop $(docker ps -aq)

Remove container (Can't remove running container)

$ docker container rm [ID]

Remove running container

$ docker container rm -f [ID]

Remove multiple containers

$ docker container rm [ID] [ID] [ID]

Remove all containers

$ docker rm $(docker ps -aq)

Images

List the all images we have downloaded

$ docker images

All images

Pull new image from docker hub

$ docker pull [IMAGE_NAME]

Pull new image

Remove image or images

$ docker image rm [IMAGE]$ docker rmi $(docker images -a -q)

Note: Any suggestion?

Happy coding

Looking for an entry-level job as Backend Developer or Full Stack Web Developer

http://pprathameshmore.github.io/


Original Link: https://dev.to/pprathameshmore/docker-for-beginners-by-beginner-3f7

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To