···11+version: '3.7'
22+services:
33+ # Update this to the name of the service you want to work with in your docker-compose.yml file
44+ dev:
55+ # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
66+ # folder. Note that the path of the Dockerfile and context is relative to the *primary*
77+ # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
88+ # array). The sample below assumes your primary file is in the root of your project.
99+ #
1010+ # build:
1111+ # context: .
1212+ # dockerfile: .devcontainer/Dockerfile
1313+1414+ image: "mcr.microsoft.com/devcontainers/rust:1-1-bullseye"
1515+1616+ volumes:
1717+ # Update this to wherever you want VS Code to mount the folder of your project
1818+ - ..:/workspaces:cached
1919+ command: sleep infinity
2020+2121+ dockerproxy:
2222+ image: wollomatic/socket-proxy:1.10.0
2323+ restart: unless-stopped
2424+ user: 0:0
2525+ mem_limit: 64M
2626+ read_only: true
2727+ cap_drop:
2828+ - ALL
2929+ security_opt:
3030+ - no-new-privileges
3131+ command:
3232+ # - '-loglevel=info'
3333+3434+ - '-loglevel=debug'
3535+ - '-allowGET=.*'
3636+ - '-allowHEAD=.*'
3737+ - '-allowPOST=.*'
3838+ - '-allowPUT=.*'
3939+ - '-allowPATCH=.*'
4040+ - '-allowDELETE=.*'
4141+ - '-allowCONNECT=.*'
4242+ - '-allowTRACE=.*'
4343+ - '-allowOPTIONS=.*'
4444+4545+ - '-listenip=0.0.0.0'
4646+ - '-allowfrom=0.0.0.0/0'
4747+4848+ #- '-allowGET=/_ping|v1\..{1,2}/(info|containers/json|events)'
4949+ #- '-allowGET=/v1\..{1,2}/(version|containers/.*|events.*)'
5050+ - '-allowbindmountfrom=/var/log,/tmp' # restrict bind mounts to specific directories
5151+ - '-watchdoginterval=3600' # check once per hour for socket availability
5252+ - '-stoponwatchdog' # halt program on error and let compose restart it
5353+ - '-shutdowngracetime=5' # wait 5 seconds before shutting down
5454+ volumes:
5555+ - /var/run/docker.sock:/var/run/docker.sock:ro
+31
.devcontainer/devcontainer.json
···11+{
22+ "name": "dockerlog",
33+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
44+ "workspaceFolder": "/workspaces",
55+ "service": "dev",
66+ "dockerComposeFile": ["compose.yml"],
77+ // Features to add to the dev container. More info: https://containers.dev/features.
88+99+1010+ // Use 'mounts' to make the cargo cache persistent in a Docker Volume.
1111+ "mounts": [
1212+ {
1313+ "source": "devcontainer-cargo-cache-${devcontainerId}",
1414+ "target": "/usr/local/cargo",
1515+ "type": "volume"
1616+ }
1717+ ],
1818+1919+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
2020+ "forwardPorts": [
2121+ 2376
2222+ ]
2323+2424+ // Use 'postCreateCommand' to run commands after the container is created.
2525+2626+ // Configure tool-specific properties.
2727+ // "customizations": {},
2828+2929+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
3030+ // "remoteUser": "root"
3131+}