- To check all the available images
- Pull/Download the image from the Docker registry/Hub to local machine.
docker pull <image name>
//Eg: docker pull mysql
- To run the images
- Additional flags
-it
- For interactive environment
-d
- To run in detached mode
-p <Host port:container port>
- To forward the port
E.g.- docker run -d -p 8080:80 nginx
docker run <image_name>
// E.g - docker run hello-world
- To check all the running images
- To see all the container list
- Attached bash cell to running container
docker exec -it <container_id> bash
- To delete all the stop container
docker container prune -f
docker logs <container-id/name>
docker start <container-id/name>
docker stop <container-id/name>
docker rm <container-id/name>
docker rmi <image-name> -f
- To share the container with others
docker commit -m "commit message" <container-id> <imagen-name:version>
// E.g - docker commit -m "added name.txt file" a17b78de1961 name_ubuntu:1.01
- To get id of all the images
- To delete all the images at once
docker rmi $(docker images -q)
- Creating our own image and container
step 1 - create Docker file (and write comand)
step 2 - docker build -t <image-name:verison> <path of docker file>
step 3 - docker run <image-name>
- Install Scout on Docker (Scan project vulnerability)
# First download the script
step 1 - curl -fsSL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh -o install-scout.sh
# Second run the script
step 2 - sh install-scout.sh
# Now Scout is install you can check your Scout version
step 3 - docker scout verison