Home Explore Blog CI



docker

2nd chunk of `content/get-started/docker-concepts/the-basics/what-is-docker-compose.md`
26675ed0b37a611d02e5d4e8fb8bcbe8f98df39a4ff0762c0000000100000996
3. Navigate into the `todo-list-app` directory:

    ```console
    cd todo-list-app
    ```

    Inside this directory, you'll find a file named `compose.yaml`. This YAML file is where all the magic happens! It defines all the services that make up your application, along with their configurations. Each service specifies its image, ports, volumes, networks, and any other settings necessary for its functionality. Take some time to explore the YAML file and familiarize yourself with its structure. 

4. Use the [`docker compose up`](/reference/cli/docker/compose/up/) command to start the application:

    ```console
    docker compose up -d --build
    ```

    When you run this command, you should see an output like this:

    ```console
    [+] Running 5/5
    ✔ app 3 layers [⣿⣿⣿]      0B/0B            Pulled          7.1s
      ✔ e6f4e57cc59e Download complete                          0.9s
      ✔ df998480d81d Download complete                          1.0s
      ✔ 31e174fedd23 Download complete                          2.5s
      ✔ 43c47a581c29 Download complete                          2.0s
    [+] Running 4/4
      ⠸ Network todo-list-app_default           Created         0.3s
      ⠸ Volume "todo-list-app_todo-mysql-data"  Created         0.3s
      ✔ Container todo-list-app-app-1           Started         0.3s
      ✔ Container todo-list-app-mysql-1         Started         0.3s
    ```

    A lot happened here! A couple of things to call out:

    - Two container images were downloaded from Docker Hub - node and MySQL
    - A network was created for your application
    - A volume was created to persist the database files between container restarts
    - Two containers were started with all of their necessary config

    If this feels overwhelming, don't worry! You'll get there!

5. With everything now up and running, you can open [http://localhost:3000](http://localhost:3000) in your browser to see the site. Feel free to add items to the list, check them off, and remove them.

    ![A screenshot of a webpage showing the todo-list application running on port 3000](images/todo-list-app.webp?border=true&w=950&h=400)

6. If you look at the Docker Desktop GUI, you can see the containers and dive deeper into their configuration.

    ![A screenshot of Docker Desktop dashboard showing the list of containers running todo-list app](images/todo-list-containers.webp?border=true&w=950&h=400)

Title: Running the To-Do List Application with Docker Compose
Summary
After cloning the sample application and navigating to its directory, the `docker compose up -d --build` command is used to start the application. This process downloads necessary container images (Node and MySQL), creates a network for the application, establishes a volume for database persistence, and starts the containers with their required configurations. The application is then accessible at http://localhost:3000, and the containers can be inspected in the Docker Desktop GUI.