0
0
Dockerdevops~10 mins

Sidecar container pattern in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the Docker Compose service to add a sidecar container that logs data.

Docker
services:
  app:
    image: myapp:latest
  sidecar:
    image: [1]
Drag options to blanks, or click blank then click option'
Afluentd
Bnginx
Cmysql
Dbusybox
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a main app image like nginx or mysql instead of a logging tool.
2fill in blank
medium

Complete the Docker Compose snippet to share a volume between app and sidecar containers.

Docker
services:
  app:
    volumes:
      - [1]:/data
  sidecar:
    volumes:
      - shared-data:/data
volumes:
  shared-data:
Drag options to blanks, or click blank then click option'
Ashared-data
Bapp-data
Clog-data
Dcache-data
Attempts:
3 left
💡 Hint
Common Mistakes
Using a volume name not declared under volumes:.
3fill in blank
hard

Fix the error in the Docker Compose sidecar service to correctly depend on the app service.

Docker
services:
  sidecar:
    image: fluentd
    depends_on:
      - [1]
Drag options to blanks, or click blank then click option'
Acache
Bdatabase
Capp
Dproxy
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated service names like database or proxy.
4fill in blank
hard

Fill both blanks to configure environment variables for the sidecar container.

Docker
services:
  sidecar:
    image: fluentd
    environment:
      - [1]=info
      - [2]=/var/log/app.log
Drag options to blanks, or click blank then click option'
ALOG_LEVEL
BAPP_MODE
CLOG_PATH
DDEBUG
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated environment variable names like APP_MODE or DEBUG.
5fill in blank
hard

Fill all three blanks to complete the Docker Compose sidecar service with restart policy and network.

Docker
services:
  sidecar:
    image: fluentd
    restart: [1]
    networks:
      - [2]
    depends_on:
      - [3]
networks:
  appnet:
Drag options to blanks, or click blank then click option'
Aalways
Bappnet
Capp
Don-failure
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong restart policies or network names not declared.