Day20 of #90DaysOfDevOps Challenge

Day20 of #90DaysOfDevOps Challenge

Docker Cheat Sheet:

??Docker images-

Show all locally stored top-level images:

docker images        

Pull an image from a registry:

docker pull [image]        

Push an image to a registry:

docker push [image]        

Create an image from a Dockerfile:

docker build [dockerfile-path]        

Build an image from a Dockerfile located in the current directory:

docker build .        

Create an image from a Dockerfile and tag it:

docker build -t [name]:[tag] [dockerfile-path]        

Specify a file to build from:

docker build -f [file-path]        

Save an image to a tar archive file:

docker save [image] > [tar-file]        

Load an image from a tar archive or stdin:

docker load --image [tar-file]        

Create an image from a tarball:

docker import [url/file]        

Create an image from a container:

docker commit [container] [new-image]        

Tag an image:

docker tag [image] [image]:[tag]        

Show history for an image:

docker history [image]        

Remove an image:

docker rmi [image]
        

Remove unused images:

docker image prune        

??Docker Container -

See the containers currently running on the system:

docker ps        

See all the containers, both running and non-running:

docker ps -a         

Create a container (without starting it):

docker create [image]        

Create an interactive container with pseudo-TTY:

docker create -it [image]        

Rename an existing container:

docker rename [container] [new-name]        

Run a command in a container based on an image:

docker run [image] [command]        

Create, start, and provide a custom name for the container:

docker run --name [container-name] [image]        

Establish a connection with a container by mapping a host port to a container port:

docker run -p [host-port]:[container-port] [image]        

Run a container and remove it after it stops:

docker run --rm [image]        

Run a detached (in the background) container:

docker run -d [image]        

Start an interactive process, such as a shell, in a container:

docker run -it [image]        

Start a container:

docker start [container]        

Stop a running container:

docker stop [container]        

Stop a running container and start it up again:

docker restart [container]        

Pause processes in a running container:

docker pause [container]        

Resume processes in a running container:

docker unpause [container]        

Block a container until others stop (after which it prints their exit codes):

docker wait [container]        

Kill a container by sending a SIGKILL to a running container:

docker kill [container]        

Attach local standard input, output, and error streams to a running container:

docker attach [container]        

Run a shell inside a running container:

docker exec -it [container] [shell]
        

Delete a container (if it is not running):

docker rm [container]        

Forcefully remove a container, even if it is running:

docker rm -f [container]        

View logs for a running container:

docker logs [container]        

Retrieve logs created before a specific point in time:

docker logs -f --until=[interval] [container]        

View real-time events for a container:

docker events [container]
        

Update the configuration of one or more containers:

docker update [container]
        

View port mapping for a container:

docker port [container]
        

Show running processes in a container:

docker top [container]
        

View live resource usage statistics for a container:

docker stats [container]
        

Show changes to files or directories on the filesystem:

docker diff [container]
        

Copy a local file to a directory in a container:

docker cp [file-path] CONTAINER:[path]        

??Docker Network:

List all networks:

docker network ls        

Create a Network:

docker network create [networkname]        

Connect a container to a network:

docker network connect [networkname] [container]        

Disconnect a container from a network:

docker network disconnect networkname container        

Display detailed information about a network:

docker network inspect networkname        

Removes a specified Network:

docker network rm [networkname]        

??Docker Volumes:

Create a local volume:

docker volume create --name [volname]         

Mounting a volume on the container start:

docker run -v [volname]:[path] [image]         

Destroy a volume:

docker volume rm [volname]        

List volumes:

docker volume ls        

??Docker-Compose:

To create containers using docker-compose file:

docker-compose up        

To destroy containers created by docker-compose:

docker-compose down        

To stop the container managed by docker-compose:

docker-compose stop        

To start the container managed by docker-compose:

docker-compose start        

To pause the container managed by docker-compose:

docker-compose pause        

To unpause the container managed by docker-compose:

docker-compose unpause        

To list all the containers created by docker-compose:

docker-compose ps        



Thank you for reading! ??


要查看或添加评论,请登录

Aishwarya keshri的更多文章

  • Day26 of #90DaysOfDevOps Challenge

    Day26 of #90DaysOfDevOps Challenge

    Jenkins Pipeline: Jenkins Pipeline is a suite of plugins that supports implementing and integrating continuous delivery…

  • Day24 of #90DaysOfDevOps Challenge

    Day24 of #90DaysOfDevOps Challenge

    ??Project: Containerise and deploy a node.js application using Jenkins Job.

  • Day23 of #90DaysOfDevOps Challenge

    Day23 of #90DaysOfDevOps Challenge

    CI/CD Continuous integration and continuous delivery help in automating the software development lifecycle stages…

    2 条评论
  • Day22 of #90DaysOfDevOps Challenge

    Day22 of #90DaysOfDevOps Challenge

    ??Jenkins Jenkins is an open-source tool that helps in creating pipelines and automating the software development…

  • Day21 of #90DaysOfDevOps Challenge

    Day21 of #90DaysOfDevOps Challenge

    Important interview questions and Answers for Docker: 1. What is the difference between an Image, Container and Engine?…

  • Day 19 of #90DaysOfDevOps Challenge

    Day 19 of #90DaysOfDevOps Challenge

    Docker Volumes When we are working on docker, the data we store gets lost when the container is destroyed. So, to…

    2 条评论
  • Day 18 of #90DaysOf DevOps Challenge

    Day 18 of #90DaysOf DevOps Challenge

    ?Docker Compose Using docker commands, we can only run and manage a single container at a time, but there can be…

  • Day17 of #90DaysOfDevOps Challenge

    Day17 of #90DaysOfDevOps Challenge

    Dockerfile: Instead of manually creating docker images by running multiple commands one by one, we can write a script…

    1 条评论
  • Day 16 of #90DaysOfDevOps Challenge

    Day 16 of #90DaysOfDevOps Challenge

    ?Docker: Docker is a containerization tool that helps us create a lightweight container with all the required packages…

  • Day15 of #90DaysOfDevOps Challenge

    Day15 of #90DaysOfDevOps Challenge

    ?Python Libraries: The collection of modules used in Python while writing different programs is known as libraries…

社区洞察

其他会员也浏览了