HexDocker Development Guide V1.0
Preparation Materials
-
Official Login Tutorial: Docker Login
-
Official Logout Tutorial: Docker Logout
Pushing & Pulling Images
-
Official Push Tutorial: Docker Push Guide
-
Official Pull Tutorial: Docker Pull Guide
Docker User Group Configuration
- Official User Group Setup: Docker Post-Installation Guide
NVIDIA Container Toolkit
- Official Installation Guide: NVIDIA Container Toolkit Setup
Saving & Uploading Images
Uploading an Image (Example: my_docker_noetic_basic
)
-
Log in to Docker Hub using the official login guide.
-
Find the target container ID:
docker container list
The target container ID here is
6d85235bc640
. -
Commit the container to an image:
docker commit <container_id> <user_name>/<image_name>
Example (username:
alicecc0
, image name:my_docker_noetic_basic
):docker commit 6d85235bc640 alicecc0/my_docker_noetic_basic
-
Push the image to Docker Hub:
docker push <user_name>/<image_name>
Example:
docker push alicecc0/my_docker_noetic_basic
Saving an Image (Example: hex_noetic_basic
)
-
Find the container ID:
docker container list -a
Example output:
The target container ID here is
fc7b3cab76e6
. -
Commit the container to an image:
docker commit fc7b3cab76e6 hexfellow/hex-docker-noetic-basic
-
Save the image to a
.tar
file:docker save -o hex_docker_noetic_basic.tar hexfellow/hex-docker-noetic-basic
-
Verify the saved file:
ls
HexDocker Preparation
If you wish to use our image and start running it with our startup script, please watch this section.
Directory Setup
Create the following directory structure (skip if you are a HEXFELLOW product user):
~/hex_docker/
├── application
│ ├── catkin_ws
│ │ └── src
│ └── git_source
└── docker_shell
The command as:
mkdir -p hex_docker/application/catkin_ws/src hex_docker/application/git_source hex_docker/docker_shell
Script Preparation (Example: hex_noetic_basic
)
- Create a
start.sh
script in thedocker_shell
directory:
cd ~/hex_docker/docker_shell && touch start.sh
- Add the following content to
start.sh
:
#!/usr/bin/env bash
HOST_USER=$(whoami)
SHELL_DIR=$(dirname "$0")
CATKIN_DIR=$SHELL_DIR/../application/catkin_ws
GIT_DIR=$SHELL_DIR/../application/git_source
CURRENT_DIR=$(pwd)
cd $SHELL_DIR
docker run -dit \
--name=hex_noetic_basic \
--net=host \
--ipc=host \
--runtime=nvidia --gpus all \
-e NVIDIA_DRIVER_CAPABILITIES=display,compute \
-e DISPLAY=$DISPLAY \
-e QT_X11_NO_MITSHM=1 \
-e XDG_RUNTIME_DIR=/run/user/$(id -u $HOST_USER) \
--privileged \
-v /dev:/dev:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-u $(id -u $HOST_USER):$(id -g $HOST_USER) \
-v /run/user/$(id -u $HOST_USER):/run/user/$(id -u $HOST_USER):rw \
-v ${CATKIN_DIR}:/home/hexfellow/catkin_ws:rw \
-v ${GIT_DIR}:/home/hexfellow/git_source:rw \
-w /home/hexfellow \
hexfellow/hex-docker-noetic-basic
cd $CURRENT_DIR