|
1 | 1 | # SINGABOAT-VRX Docker Instructions
|
2 | 2 |
|
3 |
| -#### Building Docker Image from the Dockerfile: |
4 |
| - |
5 |
| -1. Change directory to `$HOME/VRX_Workspace/src` (catkin workspace for VRX Competition): |
6 |
| -```bash |
7 |
| -$ cd <PATH/TO/DIRECTORY> . |
8 |
| -$ cd $HOME/VRX_Workspace/src |
9 |
| -``` |
10 |
| - |
11 |
| -2. Build the docker image from the dockerfile: |
| 3 | +1. Change directory to `$HOME/VRX_Workspace/src` (catkin workspace for VRX Competition) and build the docker image: |
12 | 4 | ```bash
|
13 | 5 | $ docker build --tag <USERNAME>/<IMAGE_REPOSITORY_NAME>:<TAG> -f <PATH/TO/DOCKERFILE> .
|
14 |
| -$ docker build --tag tinkertwins/singaboat-vrx:v2022.3 -f SINGABOAT-VRX/docker/Dockerfile . |
| 6 | +$ docker build --tag tinkertwins/singaboat-vrx:v2022.2 -f SINGABOAT-VRX/docker/Dockerfile . |
15 | 7 | ```
|
16 | 8 |
|
17 |
| -#### Contaninerization and Pushing the Container to Docker Hub: |
18 |
| - |
19 |
| -1. Run the image you created in the previous step inside a container: |
| 9 | +2. Create a container with the image you created in the previous step: |
20 | 10 | ```bash
|
21 | 11 | $ docker run <USERNAME>/<IMAGE_REPOSITORY_NAME>:<TAG>
|
22 |
| -$ docker run tinkertwins/singaboat-vrx:v2022.3 |
| 12 | +$ docker run tinkertwins/singaboat-vrx:v2022.2 |
23 | 13 | ```
|
24 | 14 |
|
25 |
| -2. In a new terminal window, list all containers and make a note of the desired CONTAINER ID: |
| 15 | +3. In a different terminal window, list all containers and take a note of desired CONTAINER ID: |
26 | 16 | ```bash
|
27 | 17 | $ docker ps -a
|
28 | 18 | ```
|
29 | 19 |
|
30 |
| -3. Commit changes to Docker Hub: |
| 20 | +4. Commit changes to Docker Hub: |
31 | 21 | ```bash
|
32 | 22 | $ docker commit -m "<COMMIT MESSAGE>" -a "<FULL NAME>" <CONTAINER ID> <USERNAME>/<IMAGE_REPOSITORY_NAME>:<TAG>
|
33 |
| -$ docker commit -m "SINGABOAT-VRX" -a "Tinker Twins" 35b286bf2b9b tinkertwins/singaboat-vrx:v2022.3 |
| 23 | +$ docker commit -m "SINGABOAT-VRX" -a "Tinker Twins" 35b286bf2b9b tinkertwins/singaboat-vrx:v2022.2 |
34 | 24 | ```
|
35 | 25 |
|
36 |
| -4. Login to Docker Hub: |
| 26 | +5. Login to Docker Hub: |
37 | 27 | ```bash
|
38 | 28 | $ docker login
|
39 | 29 | ```
|
40 | 30 |
|
41 |
| -5. Push the container to Docker Hub, once done, you should be able to see your repository on Docker Hub: |
| 31 | +6. Push container image to Docker Hub, once done, you should be able to see your repository on Docker Hub: |
42 | 32 | ```bash
|
43 | 33 | $ docker push <USERNAME>/<IMAGE_REPOSITORY_NAME>:<TAG>
|
44 |
| -$ docker push tinkertwins/singaboat-vrx:v2022.3 |
| 34 | +$ docker push tinkertwins/singaboat-vrx:v2022.2 |
45 | 35 | ```
|
46 | 36 |
|
47 |
| -#### Running the Containerized Image: |
48 |
| - |
49 |
| -1. Run the containerized image (follow either step 1.1 or 1.2): |
50 |
| - |
51 |
| - 1.1. Run the containerized image in **headless mode** with a name (`--name`) and interactive tty (`-it`), and remove the container upon exiting (`--rm`): |
52 |
| - ```bash |
53 |
| - $ docker run --rm -it --name <CONTAINER_NAME> <USERNAME>/<IMAGE_REPOSITORY_NAME>:<TAG> |
54 |
| - $ docker run --rm -it --name singaboat_vrx tinkertwins/singaboat-vrx:v2022.3 |
55 |
| - ``` |
56 |
| - |
57 |
| - 1.2. Run the containerized image in **GUI mode** (requires a VNC viewer) with a name (`--name`) and interactive tty (`-it`), bind TCP port of host to port of the conatainer and publish it to the host system’s interfaces (`-p`), and remove the container upon exiting (`--rm`): |
58 |
| - ```bash |
59 |
| - $ docker run --rm -it -p <HOST_PORT:CONTAINER_PORT> --name <CONTAINER_NAME> <USERNAME>/<IMAGE_REPOSITORY_NAME>:<TAG> |
60 |
| - $ docker run --rm -it -p 5900:5900 --name singaboat_vrx tinkertwins/singaboat-vrx:v2022.3 |
61 |
| - ``` |
62 |
| - |
63 |
| - Launch the VNC viewer (tested with [RealVNC Viewer](https://www.realvnc.com/en/connect/download/viewer/)) and configure the connection parameters (the password for establishing secure connection is `singaboat-vrx`): |
64 |
| - |
65 |
| - For running VNC viewer on the host machine: |
66 |
| - ```bash |
67 |
| - $ vncviewer localhost:5900 |
68 |
| - ``` |
69 |
| - |
70 |
| - For running VNC viewer on a remote machine: |
71 |
| - ```bash |
72 |
| - $ vncviewer ip.address.of.host:5900 |
73 |
| - ``` |
74 |
| - |
75 |
| - You can also configure the connection parameters via GUI of the VNC viewer application. |
| 37 | +7. Run the container to test it in interactive tty (i.e., `-it`) mode: |
| 38 | +```bash |
| 39 | +$ docker run -it --name <GIVE A CONTAINER NAME> <USERNAME>/<IMAGE_REPOSITORY_NAME>:<TAG> |
| 40 | +$ docker run -it --name singaboat_vrx tinkertwins/singaboat-vrx:v2022.2 |
| 41 | +``` |
76 | 42 |
|
77 |
| -2. [Optional] Start additional bash session(s) within the container (each in a new terminal window): |
| 43 | +8. In a different terminal window, execute a bash from within the container to access it: |
78 | 44 | ```bash
|
79 | 45 | $ docker exec -it <CONTAINER NAME> bash
|
80 | 46 | $ docker exec -it singaboat_vrx bash
|
81 | 47 | ```
|
82 | 48 |
|
83 |
| -3. Once you are done with the intended job, exit the bash session(s): |
| 49 | +9. Exit the bash: |
84 | 50 | ```bash
|
85 | 51 | $ exit
|
86 | 52 | ```
|
87 | 53 |
|
88 |
| -4. Kill the running container (required only if the containerized image is still running): |
| 54 | +10. Kill the container: |
89 | 55 | ```bash
|
90 | 56 | $ docker kill <CONTAINER NAME>
|
91 | 57 | $ docker kill singaboat_vrx
|
92 | 58 | ```
|
93 |
| - |
94 |
| -5. Remove the container (required only if the containerized image is not run with the `--rm` option): |
95 |
| -```bash |
96 |
| -$ docker rm <CONTAINER NAME> |
97 |
| -$ docker rm singaboat_vrx |
98 |
| -``` |
99 |
| - |
100 |
| -#### Cleaning Up Docker Resources: |
101 |
| - |
102 |
| -Running or caching multiple docker images or containers can quickly eat up a lot of disk space. Hence, it is always a good idea to frequently check docker disk utilization: |
103 |
| -```bash |
104 |
| -$ docker system df |
105 |
| -``` |
106 |
| - |
107 |
| -In order to avoid utilizing a lot of disk space, it is a good idea to frequently purge docker resources such as images, containers, volumes and networks that are unused or dangling (i.e. not tagged or associated with a container). There are a number of ways with a lot of options to achieve this, please refer appropriate documentation. The easiest way (but a potentially dangerous one) is to use a single command to clean up all the docker resources (dangling or otherwise): |
108 |
| -```bash |
109 |
| -$ docker system prune -a |
110 |
| -``` |
0 commit comments