Junior
What is a container in Docker?
sobes.tech AI
Answer from AI
A Docker container is a lightweight, isolated executable package of software that includes everything needed to run: code, libraries, system tools, runtime, and settings. It is created from a Docker image and is a running instance of that image.
Main characteristics:
- Isolation: Containers run in an isolated environment, not affecting the operation of other containers or the host system.
- Lightweight: Unlike virtual machines, containers do not include a full operating system, using the host's kernel, which makes them significantly lighter.
- Portability: Containers can run on any platform where Docker is installed (Linux, Windows, macOS), ensuring environment consistency from development to production.
- Reproducibility: Multiple identical containers can be created from a single image with guaranteed predictable behavior.
- Fast startup: Starting a container is much faster than booting a virtual machine.
Example of creating and running a container from the ubuntu image:
# Create and run a container from the ubuntu image
# The -it flag makes the container interactive
docker run -it ubuntu