Skip to content

Unable to create public forwarded port in devcontainer #30

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

Open
valhuber opened this issue Oct 26, 2022 · 0 comments
Open

Unable to create public forwarded port in devcontainer #30

valhuber opened this issue Oct 26, 2022 · 0 comments

Comments

@valhuber
Copy link

This project explains how to forward ports manually, which works fine.

My objective is to simplify the instructions, in particular, to create forwarded the port via the .devcontainer. My source was this doc.

I duplicated the working project to create this new project, with an altered .devcontainer:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.194.0/containers/docker-existing-dockerfile
{
	"name": "Existing Dockerfile",

	// Sets the run context to one level up instead of the .devcontainer folder.
	"context": "..",

	// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
	"dockerFile": "../For_VSCode.dockerfile",

	// Set *default* container specific settings.json values on container create.
	"settings": {},

	// add network -- enable this as required, e.g., https://valhuber.github.io/ApiLogicServer/Database-Connectivity/
	// "runArgs": ["--network=dev-network"],

	// Add the IDs of extensions you want installed when the container is created.
	"extensions": ["ms-python.python"],
	
	"portsAttributes": {
		"5656": {
			"label": "AdminApp"
		}
	},

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	"forwardPorts": [
		5656
	]

	// Uncomment the next line to run commands after the container is created - for example installing curl.
	// "postCreateCommand": "apt-get update && apt-get install -y curl",

	// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
	// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

	// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
	// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

	// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
	// "remoteUser": "vscode"
}

The port is, in fact, created. The problem appears to be that the port is not public. I verified that by doing it manually.

I tried to explore the code completion, to no avail:

Unable to make port public

....

So, seeking suggestions on creating a public port via the devcontainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant