Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Added existing dockerfile / docker-compose definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuxel committed Mar 27, 2019
1 parent 04eff18 commit d2426b6
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#-----------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
#-----------------------------------------------------------------------------------------

version: '3'
services:
devcontainer:
extends:
# Update this to the name of the service you want to work with in your docker-compose.yml file
service: your-service-name-here

# Update this if you have Docker Compose file with a different name
file: docker-compose.yml

volumes:
# Update this to wherever you want VS Code to mount the folder of your project
- .:/workspace

# Forwarding the socket is optional, but lets docker work inside the container if you install the Docker CLI.
# See the docker-in-docker-compose definition for details on how to install it.
- /var/run/docker.sock:/var/run/docker.sock

# Overrides default command so things don't shut down after the process ends. Optional, but useful for debugging.
command: sleep infinity

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Existing Docker Compose",

// Most of the configuration is in the .devcontainer/docker-compose.yml file
"dockerComposeFile": ".devcontainer/docker-compose.yml",

// This is the name of the service that extends from your existing service. Set the
// real service name in .devcontainer/docker-compose.yml
"service": "devcontainer",

// Path to where VS Code should start when connected to the service. This is typically
// a file mount in .devcontainer/docker-compose.yml
"volume": "workspace"
}
19 changes: 19 additions & 0 deletions containers/docker-existing-docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Existing Docker Compose

## Summary

*Illustrates you can reuse an existing docker-compose.yml for your dev container.*

| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code team |
| *Definition type* | Docker Compose |
| *Languages, platforms* | Any |

> **Note:** There is also a single [Dockerfile](../docker-existing-dockerfile) variation of this same definition.
## License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License. See [LICENSE](../../LICENSE).
5 changes: 5 additions & 0 deletions containers/docker-existing-dockerfile/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
14 changes: 14 additions & 0 deletions containers/docker-existing-dockerfile/.vscode/devContainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Existing Dockerfile",

// Update this if you aren't using the standard "Dockerfile" filename
"dockerFile": "Dockerfile",

// List any ports you want to expose that aren't already exposed in your Dockerfile
"appPort": [],

// If you install the Docker CE CLI in your container, this lets you interact with your host
// Docker service from inside the container. See the docker-in-docker and docker-in-docker-compose
// definitions for details.
"runArgs": ["-v","/var/run/docker.sock:/var/run/docker.sock"]
}
21 changes: 21 additions & 0 deletions containers/docker-existing-dockerfile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Existing Dockerfile

# Existing Docker Compose

## Summary

*Illustrates you can reuse an existing docker-compose.yml for your dev container.*

| Metadata | Value |
|----------|-------|
| *Contributors* | The VS Code team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | Any |

> **Note:** There is also a [Docker Compose](../docker-existing-docker-compose) variation of this same definition.
## License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License. See [LICENSE](../../LICENSE).
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
version: '3'
services:
docker-in-docker:
build:
build:
context: .
dockerfile: .devcontainer/Dockerfile
volumes:
Expand All @@ -15,6 +15,6 @@ services:
# Forwarding the socket is the key to getting this to work
- /var/run/docker.sock:/var/run/docker.sock

# Overrides default command so things don't shut down after the process ends - useful for debugging
command: sleep infinity
# Overrides default command so things don't shut down after the process ends - useful for debugging
command: sleep infinity

0 comments on commit d2426b6

Please sign in to comment.