Closed tschaffter closed 2 years ago
I can now ping the devcontainer after adding this inbound rule:
Type: Custom ICMP rule
Protocol: Echo Request
Port: N/A
Source: your choice (I would select Anywhere to be able to ping from any machine)
test.challenge-registry.org and my devcontainer EC2 have virtually the same security group. One may difference is that the dockerized app on the test server is running on the host's docker engine, while I'm currently running the containers in the devcontainer using the VS Code option docker-in-docker
.
I tried the option docker-from-docker
that now makes the devcontainer use the host's docker engine. I can now successfully start the app and access it my copy-pasting the private IP address in my browser.
A simple solution is to use docker-from-docker
instead of docker-in-docker
. Using an EC2 provide in itself all the isolation we need from our local computer.
Here are the containers running on the EC2:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c99141320412 sagebionetworks/challenge-registry-web-app:latest "/docker-entrypoint.…" 12 seconds ago Up 10 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp challenge-registry-web-app
06492c258030 sagebionetworks/challenge-registry-api:latest "/docker-entrypoint.…" 12 seconds ago Up 11 seconds 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp challenge-registry-api
8a61ce97eb44 sagebionetworks/challenge-registry-api-db:latest "docker-entrypoint.s…" 12 seconds ago Up 11 seconds 0.0.0.0:27017->27017/tcp, :::27017->27017/tcp challenge-registry-api-db
3cd9a49270cc vsc-challenge-registry-0fa1610b06cbe44dd8da6b5412593805-features-uid "/bin/sh -c 'echo Co…" 7 minutes ago Up 7 minutes quizzical_gates
Exploring how VS Code forward port with the option docker-in-docker
. The following port info is visible after starting the devcontainer. None of the stack containers are running yet.
Now I start the stack with docker compose up -d
:
I realized that I can access the challenge registry running INSIDE the devcontainer on the EC2 using localhost
(using docker-in-docker
). 🤯
In AWS Management Console
<GitHub username>-devcontainers
Department
:IBC
orCNB
(selected from this list)Project
:challenge
(selected from this list)OwnerEmail
:<your email address>
CostCenter
:NIH-ITCR / 101600
(selected from these lists)Ubuntu Server 22.04 LTS (HVM), SSD Volume Type
64-bit (x86)
ami-09d56f8956ab235b3
t3a.xlarge
Edit
vpc-0e9b80dc470a797d5 (sandcastlevpc)
subnet-025c297e427e44daf (Sandcastle-Private1)
Select existing security group
challenge-registry-devcontainers (sg-03b891e56d6a1e851)
On your local host
.ssh/config
On the EC2 instance
groups
to check that your user is a member of the groupdocker
.In VS Code
Remote - SSH
andRemote - Containers
Remote-SSH: Connect to Host...
> Select the hostSSH: <host name>
upon successfully connecting to the remote instance.File
>Open Folder...
> Select the folder of the projectRemote-Containers: Open Folder in Container...
OK
to open the project folder in the dev containerDev Container: Challenge Registry @ ssh://<host name>
Congratulations, you are now ready to develop in the dev container that runs on the EC2 instance! 🚀