mirror of https://github.com/docker/docs.git
ENGDOCS-999 (#15629)
* ENGDOCS-999 * share to distribute * share to distribute * tweaks * caps fix * functionality amendment * feedback changes * review changes * feedback changes * Update desktop/dev-environments/create-compose-dev-env.md Co-authored-by: Han Yu <han@sent.com> Co-authored-by: Han Yu <han@sent.com>
This commit is contained in:
parent
173c903a9a
commit
a3ac931614
|
@ -1296,13 +1296,11 @@ manuals:
|
|||
- path: /desktop/dev-environments/
|
||||
title: Overview
|
||||
- path: /desktop/dev-environments/create-dev-env/
|
||||
title: Create a Dev Environment
|
||||
title: Create a simple dev environment
|
||||
- path: /desktop/dev-environments/create-compose-dev-env/
|
||||
title: Create a Compose Dev Environment
|
||||
title: Create an advanced dev environment
|
||||
- path: /desktop/dev-environments/share/
|
||||
title: Share your Dev Environment
|
||||
- path: /desktop/dev-environments/specify/
|
||||
title: Specify a Dockerfile or base image
|
||||
title: Distribute your dev environment
|
||||
- sectiontitle: Extensions (Beta)
|
||||
section:
|
||||
- path: /desktop/extensions/
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
description: Dev Environments
|
||||
keywords: Dev Environments, share, collaborate, local, compose
|
||||
title: Create a Compose Dev Environment
|
||||
title: Create an advanced dev environment
|
||||
---
|
||||
|
||||
Use Dev Environments to collaborate on any Docker Compose-based projects.
|
||||
Create an advanced dev environment such as a microservice with a server, proxy and DB.
|
||||
|
||||
As with a simple Dev Environment, you can create a Compose Dev Environment from a:
|
||||
As with a simple dev environment, you can create a more advanced dev environment from a:
|
||||
- Git repository
|
||||
- Branch or tag of a Git repository
|
||||
- Subfolder of a Git repository
|
||||
|
@ -22,12 +22,12 @@ The example below, taken from the `compose-dev-env` project from the [Docker Sam
|
|||
|
||||
>Note
|
||||
>
|
||||
>If you want to create a Compose Dev Environment from a subdirectory of a Git repo, you need to define your own compose file in a .docker folder located in your subdirectory as currently, Dev Environments is not able to detect the main language of the subdirectory.
|
||||
>Currently, Dev Environments is not able to detect the main language of the subdirectory. You need to define your own base image or compose services in a `compose-dev.yaml` located in your subdirectory.
|
||||
>
|
||||
>For more information on how to configure, see the [React application with a Spring backend and a MySQL database sample](https://github.com/docker/awesome-compose/tree/master/react-java-mysql) or the [Go server with an Nginx proxy and a Postgres database sample](https://github.com/docker/awesome-compose/tree/master/nginx-golang-postgres).
|
||||
|
||||
1. From **Dev Environments**, select **Create**. The **Create a Dev Environment** dialog displays.
|
||||
2. Click **Get Started** and then copy `https://github.com/dockersamples/compose-dev-env.git` and add it to the **Enter the Git Repository** field on the **Existing Git repo** tab.
|
||||
2. Click **Get Started** and then copy `https://github.com/dockersamples/compose-dev-env.git` and add it to the **Enter the Git Repository** field with **Existing Git repo** as the source.
|
||||
3. Click **Continue**. This initializes the project, clones the Git code, and builds the Compose application. This:
|
||||
|
||||
- Builds local images for services that are defined in the Compose file
|
||||
|
@ -43,13 +43,21 @@ Note that VS Code doesn't open directly, unlike a simple Dev Environment, as the
|
|||
|
||||
You can now update your service and test it against your Compose application.
|
||||
|
||||
## Set up your own Compose Dev Environment
|
||||
## Set up your own dev environment
|
||||
|
||||
To set up a Dev Environment for your own Compose-based project, there are additional configuration steps to tell Docker Desktop how to build, start, and use the right Dev Environment image for your services.
|
||||
>**Changes to Dev Environments with Docker Desktop 4.13**
|
||||
>
|
||||
>Docker has simplified how you configure your dev environment project. All you need to get started is a `compose-dev.yaml` file. If you have an existing project with a `.docker/` folder this is automatically migrated the next time you launch.
|
||||
>
|
||||
> If you are using `.docker/docker-compose.yaml`, we move it to `../compose-dev.yaml`.
|
||||
>If you are using `.docker/config.json`, we create a `../compose-dev.yaml` file with a single service named "app”. It is configured to use the image or Dockerfile referenced in the JSON as a starting point.
|
||||
{: .important}
|
||||
|
||||
Dev Environments use an additional `docker-compose.yaml` file located in the `.docker` directory at the root of your project. This file allows you to define the image required for a dedicated service, the ports you'd like to expose, along with additional configuration options dedicated to Dev Environments coming in the future.
|
||||
To set up a dev environment, there are additional configuration steps to tell Docker Desktop how to build, start, and use the right image for your services.
|
||||
|
||||
Take a detailed look at the `docker-compose.yaml` file used in the [compose-dev-env](https://github.com/dockersamples/compose-dev-env/blob/main/.docker/docker-compose.yaml){:target="_blank" rel="noopener" class="_"} sample project.
|
||||
Dev Environments use an `compose-dev.yaml` file located in the at the root of your project. This file allows you to define the image required for a dedicated service, the ports you'd like to expose, along with additional configuration options dedicated to Dev Environments coming in the future.
|
||||
|
||||
Take a detailed look at the `compose-dev.yaml` file used in the [compose-dev-env](https://github.com/dockersamples/compose-dev-env/blob/main/.docker/docker-compose.yaml){:target="_blank" rel="noopener" class="_"} sample project.
|
||||
|
||||
```yaml
|
||||
version: "3.7"
|
||||
|
@ -120,4 +128,4 @@ In the example, the Docker Compose files are the same. However, they could be di
|
|||
|
||||
## What's next?
|
||||
|
||||
Learn how to [share your Dev Environment](share.md)
|
||||
Learn how to [distribute your dev environment](share.md)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
description: Dev Environments
|
||||
keywords: Dev Environments, share, collaborate, local
|
||||
title: Create a Dev Environment
|
||||
title: Create a simple dev environment
|
||||
---
|
||||
|
||||
You can create a Dev Environment from a:
|
||||
You can create a dev environment from a:
|
||||
- Git repository
|
||||
- Branch or tag of a Git repository
|
||||
- Subfolder of a Git repository
|
||||
|
@ -12,7 +12,7 @@ You can create a Dev Environment from a:
|
|||
|
||||
This did not conflict with any of the local files or local tooling set up on your host.
|
||||
|
||||
## Create a Dev Environment from a Git repository
|
||||
## Create a dev environment from a Git repository
|
||||
|
||||
The simplest way to get started with Dev Environments is to create a new environment by cloning the Git repository of the project you are working on.
|
||||
|
||||
|
@ -55,10 +55,10 @@ fi
|
|||
</div>
|
||||
</div>
|
||||
|
||||
To create a Dev Environment:
|
||||
To create a dev environment:
|
||||
|
||||
1. From **Under Dev Environments** in Docker Dashboard, click **Create**. The **Create a Dev Environment** dialog displays.
|
||||
2. Select **Get Started** and then copy `https://github.com/dockersamples/single-dev-env.git` and add it to the **Enter the Git Repository** field on the **Existing Git repo** tab.
|
||||
2. Select **Get Started** and then copy `https://github.com/dockersamples/single-dev-env.git` and add it to the **Enter the Git Repository** field with **Existing Git repo** as the source.
|
||||
3. Select **Continue**.
|
||||
|
||||
This detects the main language of your repository, clones the Git code inside a volume, determines the best image for your Dev Environment, and opens VS Code inside the Dev Environment container.
|
||||
|
@ -68,7 +68,7 @@ To create a Dev Environment:
|
|||
5. To launch the application, run the command `make run` in your terminal. This opens an http server on port 8080. Open [http://localhost:8080](http://localhost:8080) in your browser to see the running application.
|
||||
|
||||
|
||||
## Create a Dev Environment from a specific branch or tag
|
||||
## Create a dev environment from a specific branch or tag
|
||||
|
||||
You can create a dev environment from a specific branch (for example, a branch corresponding to a Pull Request) or a tag by adding `@mybranch` or `@tag` as a suffix to your Git URL:
|
||||
|
||||
|
@ -80,14 +80,14 @@ You can create a dev environment from a specific branch (for example, a branch c
|
|||
|
||||
Docker then clones the repository with your specified branch or tag.
|
||||
|
||||
## Create a Dev Environment from a subdirectory of a Git repository
|
||||
## Create a dev environment from a subdirectory of a Git repository
|
||||
|
||||
>Note
|
||||
>
|
||||
>Currently, Dev Environments is not able to detect the main language of the subdirectory. You need to define your own base image or compose file in a .docker folder located in your subdirectory. For more information on how to configure, see the [React application with a Spring backend and a MySQL database sample](https://github.com/docker/awesome-compose/tree/master/react-java-mysql) or the [Go server with an Nginx proxy and a Postgres database sample](https://github.com/docker/awesome-compose/tree/master/nginx-golang-postgres).
|
||||
>Currently, Dev Environments is not able to detect the main language of the subdirectory. You need to define your own base image or services in a `compose-dev.yaml`file located in your subdirectory. For more information on how to configure, see the [React application with a Spring backend and a MySQL database sample](https://github.com/docker/awesome-compose/tree/master/react-java-mysql) or the [Go server with an Nginx proxy and a Postgres database sample](https://github.com/docker/awesome-compose/tree/master/nginx-golang-postgres).
|
||||
|
||||
1. From **Dev Environments** in Docker Dashboard, click **Create**. The **Create a Dev Environment** dialog displays.
|
||||
2. Select **Get Started** and then copy your Git subfolder link into the **Enter the Git Repository** field on the **Existing Git repo** tab.
|
||||
2. Select **Get Started** and then copy your Git subfolder link into the **Enter the Git Repository** field with **Existing Git repo** as the source.
|
||||
3. Select **Continue**.
|
||||
|
||||
This clones the Git code inside a volume, determines the best image for your Dev Environment, and opens VS Code inside the Dev Environment container.
|
||||
|
@ -96,10 +96,10 @@ Docker then clones the repository with your specified branch or tag.
|
|||
|
||||
5. To launch the application, run the command `make run` in your terminal. This opens an http server on port 8080. Open [http://localhost:8080](http://localhost:8080) in your browser to see the running application.
|
||||
|
||||
## Create a Dev Environment from a local folder
|
||||
## Create a dev environment from a local folder
|
||||
|
||||
1. From **Dev Environments** in Docker Dashboard, click **Create**. The **Create a Dev Environment** dialog displays.
|
||||
2. Select **Get Started** and then the **Local Folder** tab.
|
||||
2. Select **Get Started** and then choose **Local Folder** as the source.
|
||||
3. Select **Select directory** to open the root of the code that you would like to work on.
|
||||
4. Select **Continue**.
|
||||
|
||||
|
@ -107,8 +107,8 @@ Docker then clones the repository with your specified branch or tag.
|
|||
|
||||
> **Note**
|
||||
>
|
||||
> When using a local folder for a Dev Environment, file changes are synchronized between your Dev Environment container and your local files. This can affect the performance inside the container, depending on the number of files in your local folder and the operations performed in the container.
|
||||
> When using a local folder for a dev environment, file changes are synchronized between your environment container and your local files. This can affect the performance inside the container, depending on the number of files in your local folder and the operations performed in the container.
|
||||
|
||||
## What's next?
|
||||
|
||||
Learn how to [share your Dev Environment](share.md)
|
||||
Learn how to [distribute your dev environment](share.md)
|
||||
|
|
|
@ -3,17 +3,19 @@ description: Dev Environments
|
|||
keywords: Dev Environments, share, collaborate, local
|
||||
title: Overview
|
||||
---
|
||||
|
||||
Dev Environments boosts collaboration by allowing you to share work-in-progress code with your team members. This removes any potential merge conflicts while moving between Git branches to get your code on to their machine.
|
||||
|
||||
Dev Environments uses tools built into code editors that allows Docker to access code mounted into a container rather than on your local host. This isolates the tools, files and running services on your machine allowing multiple versions of them to exist side by side.
|
||||
|
||||
You can also switch between your developer environments or your team members' environments, move between branches to look at changes that are in progress, without moving off your current Git branch. This makes reviewing PRs as simple as opening a new environment.
|
||||
|
||||
> **Beta**
|
||||
>
|
||||
> The Dev Environments feature is currently in [Beta](../../release-lifecycle.md#beta). We recommend that you do not use this in production environments.
|
||||
|
||||
Dev Environments lets you create a configurable developer environment with all the code and tools you need to quickly get up and running.
|
||||
|
||||
It uses tools built into code editors that allows Docker to access code mounted into a container rather than on your local host. This isolates the tools, files and running services on your machine allowing multiple versions of them to exist side by side.
|
||||
|
||||
>**Changes to Dev Environments with Docker Desktop 4.13**
|
||||
>
|
||||
>Docker has simplified how you configure your dev environment project. All you need to get started is a `compose-dev.yaml` file. If you have an existing project with a `.docker/` folder this is automatically migrated the next time you launch.
|
||||
{: .important}
|
||||
|
||||
{:width="700px"}
|
||||
|
||||
## Prerequisites
|
||||
|
@ -46,12 +48,11 @@ If it doesn't detect Git as a valid command, you must reinstall Git and ensure y
|
|||
|
||||
The following section lists known issues and workarounds:
|
||||
|
||||
1. When sharing a Dev Environment between Mac and Windows, the VS Code terminal may not function correctly in some cases. To work around this issue, use the Exec in CLI option in the Docker Dashboard.
|
||||
2. When sharing a Dev Environment between ARM64 and AMD64 machines, the environment is emulated.
|
||||
1. When sharing a dev environment between Mac and Windows, the VS Code terminal may not function correctly in some cases. To work around this issue, use the Exec in CLI option in the Docker Dashboard.
|
||||
|
||||
## What's next?
|
||||
|
||||
Learn how to:
|
||||
- [Create a Dev Environment](create-dev-env.md)
|
||||
- [Create a Compose Dev Environment](create-compose-dev-env.md)
|
||||
- [Share your Dev Environment](share.md)
|
||||
- [Create a simple dev environment](create-dev-env.md)
|
||||
- [Create an advanced dev environment](create-compose-dev-env.md)
|
||||
- [Distribute your dev environment](share.md)
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
---
|
||||
description: Dev Environments
|
||||
keywords: Dev Environments, share, collaborate, local, share
|
||||
title: Share your Dev Environment
|
||||
title: Distribute your dev environment
|
||||
---
|
||||
|
||||
{% include upgrade-cta.html
|
||||
body="Docker Team and Business users can now share Dev Environments with their team members."
|
||||
header-text="This feature requires a paid Docker subscription"
|
||||
target-url="https://www.docker.com/pricing?utm_source=docker&utm_medium=webreferral&utm_campaign=docs_driven_upgrade"
|
||||
%}
|
||||
The `compose-dev.yaml` config file makes distributing your dev environment easy so everyone can access the same code and any dependencies.
|
||||
|
||||
Sharing a Dev Environment lets your team members access the code, any dependencies, and the current Git branch you are working on. They can also review your changes and provide feedback before you create a pull request.
|
||||
### Distribute your dev environment
|
||||
|
||||
## Share your Dev Environment
|
||||
When you are ready to share your environment, simply copy the link to the Github repo where your project is stored, and share the link with your team members.
|
||||
|
||||
When you are ready to share your environment, hover over your Dev Environment, select the **Share** icon, and specify the Docker Hub namespace where you’d like to push your Dev Environment to.
|
||||
You can also create a link that automatically starts your dev environment when opened. This can then be placed on a GitHub README or pasted into a Slack channel, for example.
|
||||
|
||||
This creates an image of your Dev Environment, uploads it to the Docker Hub namespace you have specified, and provides a tiny URL to share with your team members.
|
||||
To create the link simply join the following link with the link to your dev environment's GitHub repository:
|
||||
|
||||
{:width="700px"}
|
||||
`https://open.docker.com/dashboard/dev-envs?url=`
|
||||
|
||||
## Open a Dev Environment that has been shared with you
|
||||
The following example opens a [Compose sample](https://github.com/docker/awesome-compose/tree/master/nginx-golang-mysql), a Go server with an Nginx proxy and a MariaDB/MySQL database, in Docker Desktop.
|
||||
|
||||
To open a Dev Environment that was shared with you, select the **Create** button in the top right-hand corner, select the **Existing Dev Environment** tab, and then paste the URL.
|
||||
[https://open.docker.com/dashboard/dev-envs?url=https://github.com/docker/awesome-compose/tree/master/nginx-golang-mysql](https://open.docker.com/dashboard/dev-envs?url=https://github.com/docker/awesome-compose/tree/master/nginx-golang-mysql)
|
||||
|
||||
Using this shared Dev Environment, your team members can access the code, any dependencies, and the current Git branch you are working on. They can also review your changes and give feedback even before you create a pull request!
|
||||
### Open a dev environment that has been distributed to you
|
||||
|
||||
To open a dev environment that has been shared with you, select the **Create** button in the top right-hand corner, select source **Existing Git repo**, and then paste the URL.
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
---
|
||||
description: Dev Environments
|
||||
keywords: Dev Environments, share, collaborate, local, Dockerfile, specify, base image
|
||||
title: Specify a Dockerfile or base image
|
||||
---
|
||||
|
||||
## Specify a Dockerfile
|
||||
|
||||
Use a JSON file to specify a Dockerfile which in turn defines your Dev Environment. You must include this as part of the `.docker` folder and then add it as a `config.json` file. For example:
|
||||
|
||||
```jsx
|
||||
{
|
||||
"dockerfile": "Dockerfile.devenv"
|
||||
}
|
||||
```
|
||||
|
||||
Next, define the dependencies you want to include in your `Dockerfile.devenv`.
|
||||
|
||||
While some images or Dockerfiles include a non-root user, many base images and Dockerfiles do not. Fortunately, you can add a non-root user named `vscode`. If you include Docker tooling, for example the Docker CLI or `docker compose`, in the `Dockerfile.devenv`, you need the `vscode` user to be included in the `docker` group.
|
||||
|
||||
```dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM <your base image>
|
||||
|
||||
RUN useradd -s /bin/bash -m vscode \
|
||||
&& groupadd docker \
|
||||
&& usermod -aG docker vscode
|
||||
|
||||
USER vscode
|
||||
```
|
||||
|
||||
## Specify a base image
|
||||
|
||||
If you already have an image built, you can specify it as a base image to define your Dev Environment. You must include this as part of the `.docker` folder and then add it as a `config.json` file. For example, to use the Jekyll base image, add:
|
||||
|
||||
```jsx
|
||||
{
|
||||
"image": "jekyll/jekyll"
|
||||
}
|
||||
```
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> This configuration is to unblock users for the Beta release only. We may move this configuration for single and multi-container applications to a Compose-based implementation in future releases.
|
Binary file not shown.
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 90 KiB |
Loading…
Reference in New Issue