The Nautilus DevOps team is working to deploy one of the applications on App Server 2 in Stratos DC. Due to a misconfiguration in the docker compose file, the deployment is failing. We would like you to take a look into it to identify and fix the issues. More details can be found below:
a. docker-compose.yml file is present on App Server 2 under /opt/docker directory.
b. Try to run the same and make sure it works fine.
c. Please do not change the container names being used. Also, do not update or alter any other valid config settings in the compose file or any other relevant data that can cause app failure.
Note: Please note that once you click on FINISH button all existing running/stopped containers will be destroyed, and your compose will be run.
Connect to App Server 2
ssh steve@stapp02 sudo -i Password for steve: Am3ric@
Inspect the Compose Directory
cd /opt/docker ls -la Output:
total 20 drwxrwxrwx 3 root root 4096 Oct 28 09:14 . drwxr-xr-x 1 root root 4096 Oct 28 09:14 .. drwxrwxrwx 2 root root 4096 Oct 28 09:14 app -rw-r--r-- 1 root root 272 Oct 28 09:14 docker-compose.yml The build context contains an app/ directory and the compose file.
View the Original Compose File
cat /opt/docker/docker-compose.yml Original content:
name: myapp services: web: image: ./app container_name: python port: - "5000:5000" volumes: - ./app:/code depends_on: - redis redis_app: image: redis container_name: redis Inspect the App Directory
ls -la /opt/docker/app Output:
total 20 drwxrwxrwx 2 root root 4096 Oct 28 09:14 . drwxrwxrwx 3 root root 4096 Oct 28 09:14 .. -rw-r--r-- 1 root root 114 Oct 28 09:14 Dockerfile -rw-r--r-- 1 root root 339 Oct 28 09:14 app.py -rw-r--r-- 1 root root 11 Oct 28 09:14 requirements.txt The app/ directory contains a Dockerfile, app.py, and requirements.txt, confirming it is a valid build context.
Issues Identified
| Line | Issue | Fix |
|---|---|---|
image: ./app | image expects an image name, not a path; should use build | Change to build: ./app |
port: | Invalid key; should be ports | Change to ports |
depends_on: - redis | References a service named redis, but the service is named redis_app | Change to redis_app |
Container names python and redis remain unchanged as required.
Fix the Compose File
Edit the file:
vi /opt/docker/docker-compose.yml Corrected content:
name: myapp services: web: build: ./app container_name: python ports: - "5000:5000" volumes: - ./app:/code depends_on: - redis_app redis_app: image: redis container_name: redis Validate the Compose File
cd /opt/docker docker compose config Output:
name: myapp services: redis_app: container_name: redis image: redis networks: default: null web: build: context: /opt/docker/app dockerfile: Dockerfile container_name: python depends_on: redis_app: condition: service_started required: true networks: default: null ports: - mode: ingress target: 5000 published: "5000" protocol: tcp volumes: - type: bind source: /opt/docker/app target: /code bind: {} networks: default: name: myapp_default The configuration validates successfully. The web service builds from /opt/docker/app, depends on redis_app, and maps port 5000.
Deploy the Compose Stack
docker compose up -d Output:
[+] up 6/8 ⠸ Image redis [⣿⣿⣿⣿⣿⣿⣿] 55.6MB / 55.6MB Pulling 3.4s [+] Building 11.7s (11/11) FINISHED => [internal] load build definition from Dockerfile 0.1s => [internal] load metadata for docker.io/library/python:3.13.0b1-slim-bullseye 1.4s => [1/4] FROM docker.io/library/python:3.13.0b1-slim-bullseye@sha256:6efce108697ffabf20924c1 4.4s => [2/4] ADD . /code 0.1s => [3/4] WORKDIR /code 0.1s => [4/4] RUN pip install -r requirements.txt 4.0s => exporting to image 1.2s [+] up 12/12g to docker.io/library/myapp-web 0.0s ✔ Image redis Pulled 3.5s ✔ Image myapp-web Built 11.8s ✔ Network myapp_default Created 0.1s ✔ Container redis Created 0.1s ✔ Container python Created 0.1s The web image built from app/Dockerfile, the redis image was pulled, and both containers were created.
Verify the Containers Are Running
docker compose ps Output:
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS python myapp-web "/bin/sh -c 'python …" web 13 seconds ago Up 12 seconds 0.0.0.0:5000->5000/tcp, [::]:5000->5000/tcp redis redis "docker-entrypoint.s…" redis_app 14 seconds ago Up 12 seconds 6379/tcp Both containers are running with the preserved names python and redis.
Check Container Logs
docker compose logs Output (abridged):
python | * Serving Flask app 'app' python | * Debug mode: on python | * Running on all addresses (0.0.0.0) python | * Running on http://127.0.0.1:5000 python | * Running on http://172.17.0.3:5000 python | Press CTRL+C to quit python | * Restarting with stat python | * Debugger is active! redis | Starting Redis Server redis | 1:C 28 Oct 2026 09:19:34.548 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo redis | 1:M 28 Oct 2026 09:19:34.549 * Running mode=standalone, port=6379. redis | 1:M 28 Oct 2026 09:19:34.555 * Ready to accept connections tcp The Flask application is serving on port 5000, and Redis is ready to accept connections on port 6379.
Test the Application
curl -I http://localhost:5000/ Output:
HTTP/1.1 200 OK Server: Werkzeug/3.1.9 Python/3.13.0b1 Date: Wed, 28 Oct 2026 09:20:17 GMT Content-Type: text/html; charset=utf-8 Content-Length: 53 Connection: close The HTTP 200 OK response confirms the application is accessible through the mapped port.
Complete Command Sequence
ssh steve@stapp02 sudo -i cd /opt/docker ls -la ls -la /opt/docker/app cat /opt/docker/docker-compose.yml vi /opt/docker/docker-compose.yml # Apply fixes: build, ports, depends_on docker compose config docker compose up -d docker compose ps docker compose logs curl -I http://localhost:5000/