Docker desktop running image doesn´t start all container like docker-compose up

Hello,
i am learning Docker and I have encountred weird behavior I need to address.

State:
I have working project that uses Dockerfile and docker-compose file to build an image that creates two containers:

  1. MS Sql server
  2. .net app interacting with the database
    When I run docker-compose up in docker-compose.yml directory, everything is build and started correctly and app is running and interacting with DB wiithout issues.

Problem:
When I try to start the image (previosly created by docker-compose up and working correctly) again using Docker desktop by the play button (no additional optional settings are used), it only starts second container for .net app which stops because sql server container doesnt even started.

Can anyone explain me what am I doing wrong? I just presumed that when docker-compose up builds an image that is started and running, I can start manually new container from the generated image.

Here you can see my docker-compose file content:


version: “3.8”

services:
sql-server:
image: Microsoft Artifact Registry
container_name: sql-server-container
restart: unless-stopped
ports:
- “1433:1433”
environment:
ACCEPT_EULA: “Y”
SA_PASSWORD: “myPass”
volumes:
- sql_data_volume:/var/opt/mssql

console-app:
build:
context: .
dockerfile: Dockerfile.deploy
image: app-image-deploy
container_name: app-container
restart: unless-stopped
depends_on:
sql-server:
condition: service_healthy

volumes:
sql_data_volume:


Thank you all in advance for your time and advices.

Have a nice day
Filip