Share

Docker Commands


Docker Commands for image Creation to container on system.

images on system
docker images


all images on the system
docker images -a


running container on system
docker ps


all container on the system
docker ps -a


all container on the system
docker ps -a


build docker project for generating image(execute where dockerfile)
docker build -t <DLLNAMEINSMALLLETTER> .


run image in container(with specifying environment. Default is production)
docker run -d -p 8001:80 -–name <CONTAINERNAME> <IMAGENAME>


EX.docker run -d -p 8001:80 --name core1 kcspl/dotnetcorewebapidocker-mjain
CHECK ON http://localhost:8001/api/values


run image in container(with specifying environment)
docker run -d -p 8002:80 -–name core2 --env ASPNETCORE_ENVIRONMENT=<ENVIRONMENT> <IMAGENAME>

EX.docker run -d -p 8002:80 --name core2 --env ASPNETCORE_ENVIRONMENT=Production kcspl/dotnetcorewebapidocker-mjain
CHECK ON http://localhost:8002/api/values


run same image in different container
docker run -d -p 8002:80 –-name <CONTAINERNAME> <IMAGENAME>


stop container
docker stop <CONTAINERNAME1> <CONTAINERNAMEn>

start container
docker start <CONTAINERNAME1> <CONTAINERNAMEn>

remove stopped container
docker rm <CONTAINERNAME1> <CONTAINERNAMEn>

remove non-container image(-f for force delete)
docker rmi <IMAGENAME1> <IMAGENAMEn>

tag existing image
docker tag <IMAGENAME> <IMAGENAME1>:<TAG>

login to docker hub
docker login


push image to docker hub(upload as PRIVATE)(one private repository in default plan)
docker push <IMAGENAME>:<TAG>

https://www.youtube.com/watch?v=tm5Gw1rIg-M&list=PLReL099Y5nRdRjTqPN86waOug-eyT9yrQ

1