Complete the code to start a Docker container named 'webapp'.
docker run --name [1] -d nginxThe --name option sets the container's name. Here, 'webapp' is the correct name to start the container.
Complete the command to list all running Docker containers.
docker [1]The docker ps command lists all running containers.
Fix the error in the Docker Compose file to define a service named 'app'.
services: [1]: image: nginx ports: - "80:80"
The service name should be 'app' as required. This identifies the container in orchestration.
Fill both blanks to create a Docker Compose service that restarts automatically on failure.
services:
web:
image: nginx
restart: [1]
ports:
- "[2]:80"The restart: on-failure option restarts the container only if it fails. Port mapping 8080:80 exposes port 80 inside the container to port 8080 on the host.
Fill all three blanks to define a Docker Compose service with environment variables and volume mapping.
services:
db:
image: postgres
environment:
- POSTGRES_USER=[1]
- POSTGRES_PASSWORD=[2]
volumes:
- [3]:/var/lib/postgresql/dataEnvironment variables set the database user and password. Volume mapping ./dbdata:/var/lib/postgresql/data stores data on the host for persistence.