Visual Studio makes it really easy to create a Docker compose file for an existing solution.
Here are the steps to get there:
- Open your solution in Visual Studio
- Right click on one of your projects and choose Add –> Container Orchestrator Support
- Choose Docker compose in the Add Container Orchestrator dialog and click OK
- Choose Linux as the Target OS and click OK
- A new Docker Compose project is generated
- Inside this project you find a docker-compose.yml file with a reference to the project you’ve selected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
services: | |
frontend: | |
image: ${DOCKER_REGISTRY-}frontend | |
build: | |
context: . | |
dockerfile: DockerComposeExample/Dockerfile |
- To add the other projects, follow the same procedure; right click on another project and choose Add –> Container Orchestrator Support again
- The docker-compose.yml file will be updated with the new project information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
services: | |
frontend: | |
image: ${DOCKER_REGISTRY-}frontend | |
build: | |
context: . | |
dockerfile: DockerComposeExample/Dockerfile | |
backend: | |
image: ${DOCKER_REGISTRY-}backend | |
build: | |
context: . | |
dockerfile: Backend/Dockerfile |
No comments:
Post a Comment