Sobes.tech
Junior — Middle

What tools and commands have you used for management and containerization with Docker?

sobes.tech AI

Answer from AI

The following tools and commands are commonly used for management and containerization with Docker:

  • docker build — create an image from a Dockerfile.
  • docker run — start a container from an image.
  • docker ps — view running containers.
  • docker stop and docker kill — stop a container.
  • docker rm — remove a container.
  • docker images — view local images.
  • docker rmi — delete an image.
  • docker logs — view container logs.
  • docker exec — execute a command inside a running container.

Example of creating and running a container with a Python application:

# Create an image from Dockerfile
docker build -t my-python-app .

# Run the container
docker run -d -p 5000:5000 my-python-app

# View running containers
docker ps

# Get logs
docker logs <container_id>

For managing more complex configurations, Docker Compose is often used, where multiple services are described in a single YAML file and started with the command docker-compose up.