Recently i learned on docker thought of sharing the knowledge so that it would be both comprehensive and notes for myself
- docker run <image name> ---> Create and Run Container
- docker start <container name> || <container id>--->Start the container
- docker stop <container name> || <container id> ---> Stop the container
- docker restart <container name> || <container id> --> Restart the container
- docker inspect <container name> || <container id> --> Inspect the running Container
- docker logs <container name> || <container id>---> to view the logs of container
- docker ps ---> List of running Docker
- docker rm <container name> or docker remove <container name>--> Remove the container
Lets now jump into docker build statement
For Build we have some keywords to remember
- FROM --> to specify which base image u want to copy
- RUN --> execute Specified Command
- ENTRYPOINT --> command executed when the container is started
- CMD -->command executed when the container is started but it can overide the executive statement.
- EXPOSE --> Open Designated Port that is used by container
- LABEL/MAINSTREAM -->sets a label with a key of “mainstream”
Commands in the Docker file with Build
- Building an image from Dockerfile ----> docker build <image_file>
- Building an image from container and commit it-->docker commit <container> <image>:<tag>
- Pulling the image --> docker image pull <image name>
- Tagging the docker image --> docker tag <source img>: <tag > <target image>:<tag>
- Pushing image to docker hub --> docker login && docker image push <image_name>
- List container Image --> docker image ls
- Delete the image --> docker image <remove || rms>