1-
2- # Ruby official container
3-
4- https://hub.docker.com/_/ruby
5-
6-
7- Dockerfile
8-
9- ```
10- FROM ruby:3.0
11- WORKDIR /usr/src/app
12- # CMD ["./your-daemon-or-script.rb"]
13- # ENV PORT 3000
14- # EXPOSE $PORT
15- ENTRYPOINT [ "/bin/bash" ]
16- ```
17-
1+ # Creating a Docker container with Ruby on it
182
193Create the docker image
204```
@@ -27,46 +11,33 @@ docker create --name ruby-server --publish 3000:3000 ruby-image
2711```
2812
2913Start the container
30- This starts it and exits immediately (!!!)
3114```
32- docker start webdev-nutshell
33- ```
34-
35-
36- Start the container (detached iteractive)
37- https://stackoverflow.com/a/31143261/446681
38- ```
39- docker run -dit -p 3000:3000 --name ruby-server ruby-image
40-
41-
15+ docker start ruby-server
4216```
4317
44-
4518SSH into the container
4619```
4720docker exec -it ruby-server /bin/bash
4821```
4922
5023
51- TODO: Port binding in docker is not working
52- See https://stackoverflow.com/questions/54940990/docker-cant-connect-to-container-exposed-port
53-
54-
55- # Docker build
56-
57- https://docs.docker.com/engine/reference/commandline/build/
58-
59- ```
60- docker build - < Dockerfile
61-
62- ```
63-
64-
6524# VS Code Docker Extension
6625https://code.visualstudio.com/docs/devcontainers/containers
6726https://code.visualstudio.com/docs/devcontainers/tutorial
6827https://code.visualstudio.com/docs/devcontainers/create-dev-container
6928
29+ https://containers.dev/implementors/json_reference/
30+ https://containers.dev/implementors/reference/
31+
32+ # Docker
33+ Docker Hub https://hub.docker.com/_/ruby
34+ Keep container running https://devopscube.com/keep-docker-container-running/
35+
36+ Start the container (detached iteractive)
37+ https://stackoverflow.com/a/31143261/446681
38+ ```
39+ docker run -dit -p 3000:3000 --name ruby-server ruby-image
40+ ```
7041
7142
7243# Misc
0 commit comments