Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQ] Documentation around using the dev conatainer #622

Open
iainwhiteigs opened this issue Feb 26, 2024 · 2 comments
Open

[FEATURE REQ] Documentation around using the dev conatainer #622

iainwhiteigs opened this issue Feb 26, 2024 · 2 comments
Labels
feature triage Issues that need to be looked at

Comments

@iainwhiteigs
Copy link

Description.

I need some basic help with configuring the dev-container specified here: https://hub.docker.com/_/microsoft-iotedge-iotedgedev

I guess I need to create a .devcontainer/devcontainer.json file but I've attempted this and failed - Just a simple example and guide to setting this up would be very useful. If documentation already exists, please forgive me - but I can't find it.

@iainwhiteigs iainwhiteigs added feature triage Issues that need to be looked at labels Feb 26, 2024
@konichi3
Copy link
Collaborator

Please use this quickstart guide to set up the devcontainer
https://github.com/Azure/iotedgedev/blob/main/docs/quickstart.md#quickstart-steps

@RollsChris
Copy link

Hi, seems we are traveling the same path :). Here is what i have so far, im using a Dockerfile and compose:

.devcontainer/devcontainer.json:

{
	"name": "iotedge-devcontainer",
	"dockerComposeFile": "docker-compose.yml",
	"service": "iotedgedev",
	"workspaceFolder": "/workspaces/edge",

	
	//"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/edge,type=bind,consistency=cached",
	//"image": "mcr.microsoft.com/iotedge/iotedgedev",
	// "runArgs": [
	// 	"-v",
	// 	"/var/run/docker.sock:/var/run/docker.sock" // Without this volume the container would not be able to talk with docker on the host. i.e. "docker container ls will fail"
	// ],
		// Use this environment variable if you need to bind mount your local source code into a new container.
	"remoteEnv": {
		"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
	},
	// "remoteUser": "root", // Default user for when opening a terminal inside the container.
	"customizations": {
		"vscode": {
			"settings": {
				"terminal.integrated.defaultProfile.linux": "bash",
				"terminal.integrated.profiles.linux": {
					"bash": {
						"path": "/bin/bash"
					}
				}
			},
			"extensions": [ // List of extensions to install in the container
				"esbenp.prettier-vscode",
				"ms-dotnettools.csdevkit",
				"ms-dotnettools.csharp",
				"ms-azuretools.vscode-docker"
			]
		}
	},		
	"features": {
		"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
		"ghcr.io/devcontainers/features/dotnet:2": {}
	},
	//"postCreateCommand": "az extension add --name azure-iot"
}

docker-compose.yml

version: '3'

services:
  iotedgedev:
    build: 
      context: .
      dockerfile: Dockerfile
    volumes:
      # # Forwards the local Docker socket to the container [NOT NEEDED AS WE ARE USING DOCKER-OUTSIDE-DOCKER]
      # - /var/run/docker.sock:/var/run/docker-host.sock 
      # Update this to wherever you want VS Code to mount the folder of your project
      - ../:/workspaces/edge:cached
    # # Overrides default command so things don't shut down after the process ends.
    command: /bin/sh -c "while sleep 1000; do :; done"

    # Uncomment the next four lines if you will use a ptrace-based debuggers like C++, Go, and Rust.
    # cap_add:
    #  - SYS_PTRACE
    # security_opt:
    #   - seccomp:unconfined

    # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. 
    # (Adding the "ports" property to this file will not forward from a Codespace.)
volumes:
  cloudedge:
    external: true

Dockerfile

# Note: You can use any Debian/Ubuntu based image you want. 
FROM mcr.microsoft.com/iotedge/iotedgedev:latest as base

# Missing from base imagea
RUN sudo apt-get update && sudo az extension add --name azure-iot

# USER iotedgedev
# USER root

Hope this helps.

They need to clean up a lot of there documentation and this Rep... its a painful journey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature triage Issues that need to be looked at
Projects
None yet
Development

No branches or pull requests

3 participants