|
| 1 | +--- |
| 2 | +title: Open a new project |
| 3 | +description: Learn how to open a new local or remote project, or an existing project in Docker Projects. |
| 4 | +keywords: Docker, projects, docker deskotp, containerization, open, remote, local |
| 5 | +weight: 20 |
| 6 | +--- |
| 7 | + |
| 8 | +> [!IMPORTANT] |
| 9 | +> |
| 10 | +> To use Docker Projects, you must enable the **Access experimental features** setting in Docker Desktop. See [Features in development](/manuals/desktop/settings-and-maintenance/settings.md#features-in-development) for more information. |
| 11 | +
|
| 12 | +## New projects |
| 13 | + |
| 14 | +To run a new project, it must be stored locally. In the **Projects** view in Docker Desktop, local projects display the local path under the project. |
| 15 | + |
| 16 | +### Open a new local project |
| 17 | + |
| 18 | +A project consists of your code and at least one Compose file. Ensure that you have a Compose file before trying to open a new project. |
| 19 | + |
| 20 | +To open a new project: |
| 21 | + |
| 22 | +1. Sign in to Docker Desktop, and go to **Projects**. |
| 23 | + |
| 24 | +2. Select **Open a local folder**. This lets you select a local folder that contains your project’s code and a Compose file. |
| 25 | + |
| 26 | + > [!NOTE] |
| 27 | + > |
| 28 | + > A local folder can also be the folder of a Git repository that you have already cloned. |
| 29 | +
|
| 30 | +3. Configure your project by giving it a name and setting the owner, then select **Next**. |
| 31 | + |
| 32 | + > [!NOTE] |
| 33 | + > |
| 34 | + > If you are part of a Docker organization you have the option to [share your project](share.md) with the organization. |
| 35 | +
|
| 36 | +4. Specify how to run your project by selecting **New run command**: |
| 37 | + |
| 38 | + > [!TIP] |
| 39 | + > |
| 40 | + > While configuring your run command, you can view the equivalent `docker compose up` command in the **Run command** section on the configuration page. You can also use this command to run your project from the command line. You can refer to the [`docker compose up` reference documentation](/reference/cli/docker/compose/up.md) to learn more about the options you configure. |
| 41 | +
|
| 42 | + - **Name**: Specify a name to identify the run command. |
| 43 | + - **Compose files**: Select one or more Compose files from your project. |
| 44 | + - **Flags**: Optionally, select one or more flags for your run command. |
| 45 | + |
| 46 | + > [!TIP] |
| 47 | + > |
| 48 | + > While the `--env-file` flag isn't currently supported, you can specify environment variables in your Compose file, or use the **Tasks** option to run a script that sets your environment variables. |
| 49 | +
|
| 50 | + - **Services that will run**: After selecting one or more Compose files, the services defined in the files will appear here. If there is more than one service, you can optionally choose to not run a service by deselecting the checkbox. |
| 51 | + - **Tasks (Advanced options)**: Optionally specify a command to run before running the project. For example, if you want to run a bash script from the project directory named `set-vars.sh`, you can specify bash `set-vars.sh`. Or, on Windows, to run a script with `cmd.exe` named `set-vars.bat`, specify `set-vars.bat`. Note that a task can access environment variables from your terminal profile, but it can't access local shell functions nor aliases. |
| 52 | + |
| 53 | +5. Select **Save changes**. |
| 54 | + |
| 55 | +Your project is now ready to run. |
| 56 | + |
| 57 | +### Open a new remote project |
| 58 | + |
| 59 | +The following steps prompt you to clone the Git repository for your project. |
| 60 | + |
| 61 | +If you have already cloned the repository outside of Docker Projects, then you can open the project as a new project and Docker Projects will automatically detect and link the repository. |
| 62 | + |
| 63 | +To clone and open a remote project: |
| 64 | + |
| 65 | +1. Sign in to Docker Desktop, and go to **Projects**. |
| 66 | + |
| 67 | +2. Select **Clone a git repository**. This lets you specify a Git repository and a local folder to clone that repository to. The repository must contain at least your project’s code and a Compose file. |
| 68 | + |
| 69 | +3. Enter the remote source and choose the local destination to clone to. |
| 70 | + |
| 71 | +4. Select **Clone project**. |
| 72 | + |
| 73 | +5. Configure your project by giving it a name and setting the owner, then select **Next**. |
| 74 | + |
| 75 | + > [!NOTE] |
| 76 | + > |
| 77 | + > If you are part of a Docker organization you have the option to [share your project](share.md) with the organization. |
| 78 | +
|
| 79 | +6. Specify how to run your project by selecting **New run command**: |
| 80 | + |
| 81 | + > [!TIP] |
| 82 | + > |
| 83 | + > While configuring your run command, you can view the equivalent `docker compose up` command in the **Run command** section on the configuration page. You can also use this command to run your project from the command line. You can refer to the [`docker compose up` reference documentation](/reference/cli/docker/compose/up.md) to learn more about the options you configure. |
| 84 | +
|
| 85 | + - **Name**: Specify a name to identify the run command. |
| 86 | + - **Compose files**: Select one or more Compose files from your project. |
| 87 | + - **Flags**: Optionally, select one or more flags for your run command. |
| 88 | + |
| 89 | + > [!TIP] |
| 90 | + > |
| 91 | + > While the `--env-file` flag isn't currently supported, you can specify environment variables in your Compose file, or use the **Tasks** option to run a script that sets your environment variables. |
| 92 | +
|
| 93 | + - **Services that will run**: After selecting one or more Compose files, the services defined in the files will appear here. If there is more than one service, you can optionally choose to not run a service by deselecting the checkbox. |
| 94 | + - **Tasks (Advanced options)**: Optionally specify a command to run before running the project. For example, if you want to run a bash script from the project directory named `set-vars.sh`, you can specify bash `set-vars.sh`. Or, on Windows, to run a script with `cmd.exe` named `set-vars.bat`, specify `set-vars.bat`. Note that a task can access environment variables from your terminal profile, but it can't access local shell functions nor aliases. |
| 95 | + |
| 96 | +7. Select **Save changes**. |
| 97 | + |
| 98 | +## Existing projects |
| 99 | + |
| 100 | +### Open an existing local project |
| 101 | + |
| 102 | +1. Sign in to Docker Desktop, and go to **Projects**. |
| 103 | + |
| 104 | +2. Open your project by selecting your project under **Recents**, or by selecting the specific owner that your project is associated with and then select your project. |
| 105 | + |
| 106 | +### Open an existing remote project |
| 107 | + |
| 108 | +In the **Projects** view in Docker Desktop, existing remote projects display **No local copy** under the project. |
| 109 | + |
| 110 | +You’ll see remote projects when you are new to the team and are accessing a shared project, remove a project from Docker Desktop, or access Docker Desktop from a new device after creating a project associated with a Git repository. |
| 111 | + |
| 112 | +To open an existing remote project, you can choose between: |
| 113 | + |
| 114 | + - Cloning the project into a local destination. |
| 115 | + - Linking to an existing folder where the project has already been cloned |
| 116 | + |
| 117 | +## What's next? |
| 118 | + |
| 119 | + - [View your project](/manuals/projects/view.md) |
| 120 | + - [Add or edit your run commands](/manuals/projects/edit.md) |
| 121 | + - [Manage your projects](/manuals/projects/manage.md) |
0 commit comments