3

With the VS Code extension Visual Studio Code Remote - Containers I can develop inside a container that is spun up on my local computer via Docker Desktop.

Is there any way to develop inside a container hosted on Azure, AWS, Google Cloud, or any other cloud system instead?

I can't use Docker Desktop locally because I'm on a Macbook Pro with Apple Silicon, meaning that Docker does not work the same way as it would on an Intel chip.

UPDATE 2021-12-04:

I solved the issue by using GitHub Codespaces

3
  • Do you have access to the machine that hosts the docker container? If that's the case, you might be able to use docker context. Commented Aug 8, 2021 at 18:11
  • @Aviv Lo yes I do, I have access to everything. How would I do that? Commented Aug 9, 2021 at 10:29
  • I'll write a proper answer after work. Commented Aug 9, 2021 at 19:18

1 Answer 1

1

You can use docker context

It forwards the remote docker socket via ssh to your local machine

docker context create NAME_OF_THE_CONTEXT --docker "host=ssh://$SERVER_USER_NAME@$SERVER_IP"

Use the context

docker context use NAME_OF_THE_CONTEXT

Now you can run docker commands in your local terminal that will be executed on the remote host.

So now you can connect to remote containers via VSCode as if the containers are running remotely.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks! I was able to create a Docker Droplet on DigitalOcean. Connect to it via docker context as you described. I validated that I was in the right context via docker info. However, when I use the VS Code command Reopen in Container I get the following error: docker: error during connect: Post "http://docker/v1.24/containers/create": command [ssh -l root -- <IP> docker system dial-stdio] has exited with exit status 255, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=ssh: connect to host <IP> port 22: Connection refused
Let me try this locally as well.
@Martin can you ssh to the remote separately? You might need to add your local public key to ~/.ssh/authorized_keys

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.