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
18
2
19
3
Create the docker image
20
4
```
@@ -27,46 +11,33 @@ docker create --name ruby-server --publish 3000:3000 ruby-image
27
11
```
28
12
29
13
Start the container
30
- This starts it and exits immediately (!!!)
31
14
```
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
42
16
```
43
17
44
-
45
18
SSH into the container
46
19
```
47
20
docker exec -it ruby-server /bin/bash
48
21
```
49
22
50
23
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
-
65
24
# VS Code Docker Extension
66
25
https://code.visualstudio.com/docs/devcontainers/containers
67
26
https://code.visualstudio.com/docs/devcontainers/tutorial
68
27
https://code.visualstudio.com/docs/devcontainers/create-dev-container
69
28
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
+ ```
70
41
71
42
72
43
# Misc
0 commit comments