Skip to content

Commit

Permalink
fix some path issue and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
irfan.putra committed Jan 3, 2025
1 parent c0d51ba commit c6ab82b
Show file tree
Hide file tree
Showing 22 changed files with 903 additions and 161 deletions.
16 changes: 16 additions & 0 deletions .devcontainer/.devpod-internal/0/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Limitations

This docker-in-docker Dev Container Feature is roughly based on the [official docker-in-docker wrapper script](https://github.com/moby/moby/blob/master/hack/dind) that is part of the [Moby project](https://mobyproject.org/). With this in mind:
* As the name implies, the Feature is expected to work when the host is running Docker (or the OSS Moby container engine it is built on). It may be possible to get running in other container engines, but it has not been tested with them.
* The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, like in this example:
```
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/typescript-node:16
```
See [Issue #219](https://github.com/devcontainers/features/issues/219) for more details.


## OS Support

This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.

`bash` is required to execute the `install.sh` script.
53 changes: 53 additions & 0 deletions .devcontainer/.devpod-internal/0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

# Docker (Docker-in-Docker) (docker-in-docker)

Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.

## Example Usage

```json
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
}
```

## Options

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Select or enter a Docker/Moby Engine version. (Availability can vary by OS version.) | string | latest |
| moby | Install OSS Moby build instead of Docker CE | boolean | true |
| mobyBuildxVersion | Install a specific version of moby-buildx when using Moby | string | latest |
| dockerDashComposeVersion | Default version of Docker Compose (latest, v2 or none) | string | latest |
| azureDnsAutoDetection | Allow automatically setting the dockerd DNS server when the installation script detects it is running in Azure | boolean | true |
| dockerDefaultAddressPool | Define default address pools for Docker networks. e.g. base=192.168.0.0/16,size=24 | string | - |
| installDockerBuildx | Install Docker Buildx | boolean | true |
| installDockerComposeSwitch | Install Compose Switch (provided docker compose is available) which is a replacement to the Compose V1 docker-compose (python) executable. It translates the command line into Compose V2 docker compose then runs the latter. | boolean | true |

## Customizations

### VS Code Extensions

- `ms-azuretools.vscode-docker`

## Limitations

This docker-in-docker Dev Container Feature is roughly based on the [official docker-in-docker wrapper script](https://github.com/moby/moby/blob/master/hack/dind) that is part of the [Moby project](https://mobyproject.org/). With this in mind:
* As the name implies, the Feature is expected to work when the host is running Docker (or the OSS Moby container engine it is built on). It may be possible to get running in other container engines, but it has not been tested with them.
* The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, like in this example:
```
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/typescript-node:16
```
See [Issue #219](https://github.com/devcontainers/features/issues/219) for more details.


## OS Support

This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.

`bash` is required to execute the `install.sh` script.


---

_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/docker-in-docker/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
87 changes: 87 additions & 0 deletions .devcontainer/.devpod-internal/0/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"id": "docker-in-docker",
"version": "2.12.0",
"name": "Docker (Docker-in-Docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker",
"description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.",
"options": {
"version": {
"type": "string",
"proposals": [
"latest",
"none",
"20.10"
],
"default": "latest",
"description": "Select or enter a Docker/Moby Engine version. (Availability can vary by OS version.)"
},
"moby": {
"type": "boolean",
"default": true,
"description": "Install OSS Moby build instead of Docker CE"
},
"mobyBuildxVersion": {
"type": "string",
"default": "latest",
"description": "Install a specific version of moby-buildx when using Moby"
},
"dockerDashComposeVersion": {
"type": "string",
"enum": [
"none",
"latest",
"v2"
],
"default": "latest",
"description": "Default version of Docker Compose (latest, v2 or none)"
},
"azureDnsAutoDetection": {
"type": "boolean",
"default": true,
"description": "Allow automatically setting the dockerd DNS server when the installation script detects it is running in Azure"
},
"dockerDefaultAddressPool": {
"type": "string",
"default": "",
"proposals": [],
"description": "Define default address pools for Docker networks. e.g. base=192.168.0.0/16,size=24"
},
"installDockerBuildx": {
"type": "boolean",
"default": true,
"description": "Install Docker Buildx"
},
"installDockerComposeSwitch": {
"type": "boolean",
"default": true,
"description": "Install Compose Switch (provided docker compose is available) which is a replacement to the Compose V1 docker-compose (python) executable. It translates the command line into Compose V2 docker compose then runs the latter."
},
"disableIp6tables": {
"type": "boolean",
"default": false,
"description": "Disable ip6tables (this option is only applicable for Docker versions 27 and greater)"
}
},
"entrypoint": "/usr/local/share/docker-init.sh",
"privileged": true,
"containerEnv": {
"DOCKER_BUILDKIT": "1"
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker"
]
}
},
"mounts": [
{
"source": "dind-var-lib-docker-${devcontainerId}",
"target": "/var/lib/docker",
"type": "volume"
}
],
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
]
}
38 changes: 38 additions & 0 deletions .devcontainer/.devpod-internal/0/devcontainer-features-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
set -e

on_exit () {
[ $? -eq 0 ] && exit
echo 'ERROR: Feature "Docker (Docker-in-Docker)" (ghcr.io/devcontainers/features/docker-in-docker) failed to install! Look at the documentation at ${documentation} for help troubleshooting this error.'
}

trap on_exit EXIT

set -a
. ../devcontainer-features.builtin.env
. ./devcontainer-features.env
set +a

echo ===========================================================================

echo 'Feature : Docker (Docker-in-Docker)'
echo 'Description : Create child containers *inside* a container, independent from the host'\''s docker instance. Installs Docker extension in the container along with needed CLIs.'
echo 'Id : ghcr.io/devcontainers/features/docker-in-docker'
echo 'Version : 2.12.0'
echo 'Documentation : https://github.com/devcontainers/features/tree/main/src/docker-in-docker'
echo 'Options :'
echo ' AZUREDNSAUTODETECTION="true"
DISABLEIP6TABLES="false"
DOCKERDASHCOMPOSEVERSION="latest"
DOCKERDEFAULTADDRESSPOOL=""
INSTALLDOCKERBUILDX="true"
INSTALLDOCKERCOMPOSESWITCH="true"
MOBY="true"
MOBYBUILDXVERSION="latest"
VERSION="latest"'
echo 'Environment :'
printenv
echo ===========================================================================

chmod +x ./install.sh
./install.sh
9 changes: 9 additions & 0 deletions .devcontainer/.devpod-internal/0/devcontainer-features.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
AZUREDNSAUTODETECTION="true"
DISABLEIP6TABLES="false"
DOCKERDASHCOMPOSEVERSION="latest"
DOCKERDEFAULTADDRESSPOOL=""
INSTALLDOCKERBUILDX="true"
INSTALLDOCKERCOMPOSESWITCH="true"
MOBY="true"
MOBYBUILDXVERSION="latest"
VERSION="latest"
Loading

0 comments on commit c6ab82b

Please sign in to comment.