-
Notifications
You must be signed in to change notification settings - Fork 0
Ruby and Docker
These steps are a manual process to create the Docker container and connect VS Code to it than what's indicated on the tutorial.md file on the workshop materials. But they can help troubleshoot if people have problems or if VS Code acts up.
Clone this repo (you only need the Dockerfile
from the repo so technically you can just get that one file.)
git clone https://github.com/hectorcorrea/webdev-nutshell.git
cd webdev-nutshell
Once inside the webdev-nutshell
directory create the docker image (the command must be run on the same folder as the Dockerfile
is saved):
docker build -t ruby-image .
Create the Docker container
docker create --name ruby-server --publish 3000:3000 ruby-image
Start the container
docker start ruby-server
SSH into the container
docker exec -it ruby-server /bin/bash
Or Launch VS Code, select "Attach to a Running Container", and select the /ruby-server
container. Once you are connected you can run the following commands from the VS Code Terminal to get the code in the container and work directly from it:
git clone https://github.com/hectorcorrea/webdev-nutshell.git
cd webdev-nutshell
docker stop your-container
docker rm your-container
docker system prune -a -f
Docker Hub https://hub.docker.com/_/ruby Keep container running https://devopscube.com/keep-docker-container-running/
Start the container (detached interactive) https://stackoverflow.com/a/31143261/446681
docker run -dit -p 3000:3000 --name ruby-server ruby-image
https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web
https://code.visualstudio.com/docs/devcontainers/containers https://code.visualstudio.com/docs/devcontainers/tutorial https://code.visualstudio.com/docs/devcontainers/create-dev-container
https://containers.dev/implementors/json_reference/ https://containers.dev/implementors/reference/