docker commands | | Restart the docker service | Search

These Docker commands build an image named "act-selenium", list all your local Docker images, and display information about all your Docker containers, both running and stopped.

Run example

npm run import -- "use Docker"

use Docker

docker build -t act-selenium
docker images
docker ps -a

What the code could have been:

#!/bin/bash

# Define a function to build and tag the Docker image
build_and_tag() {
  docker build -t $1
}

# Define a function to list all available Docker images
list_images() {
  docker images
}

# Define a function to list all running and stopped Docker containers
list_containers() {
  docker ps -a
}

# Build and tag the Docker image with the name "act-selenium"
build_and_tag "act-selenium"

# List all available Docker images
echo "Available Docker Images:"
list_images

# List all running and stopped Docker containers
echo "Running and Stopped Docker Containers:"
list_containers

Here's a breakdown of those Docker commands:

In summary:

  1. Build a Docker image named "act-selenium" based on your Dockerfile.
  2. View a list of all your Docker images.
  3. View a list of all your Docker containers, including stopped ones.