docker

docker

Docker Training Course for the Absolute Beginner Course | KodeKloud

1

Docker Basic Commands | KodeKloud
Delete all containers from the Docker Host.

1
docker rm -f $(docker ps -aq)

Delete the ubuntu Image.

1
docker rmi ubuntu

You are required to pull a docker image which will be used to run a container later. Pull the image nginx:1.14-alpine

1
docker pull nginx:1.14-alpine

Run a container with the nginx:1.14-alpine image and name it webapp

1
docker run -d --name webapp nginx:1.14-alpine
  • docker run: Command to create and start a new container.
  • -d: Runs the container in detached mode (in the background).
  • --name webapp: Assigns the name webapp to the container.
  • nginx:1.14-alpine: Specifies the image and tag to use for the container.
    Cleanup: Delete all images on the host
    1
    docker rmi -f $(docker images -aq)
    In Docker commands, -aq is a combination of options that can be used with certain Docker commands like docker ps and docker images. Here’s what each option means:
  • -a: This stands for “all.” It lists all items, not just the default filtered view. For example:
    • With docker ps -a, it lists all containers (both running and stopped).
    • With docker images -a, it lists all images, including intermediate images used in builds.
  • -q: This stands for “quiet” mode. It only outputs the IDs, rather than the full details.
    • With docker ps -q, it lists only the container IDs.
    • With docker images -q, it lists only the image IDs.
      When combined as -aq:
  • docker ps -aq: Lists only the IDs of all containers.
  • docker images -aq: Lists only the IDs of all images.

2

作者

zyh

发布于

2024-10-28

更新于

2024-11-13

许可协议

评论