Skip to content

HexDocker Development Guide V1.0

Preparation Materials

Pushing & Pulling Images

Docker User Group Configuration

NVIDIA Container Toolkit

Saving & Uploading Images

Uploading an Image (Example: my_docker_noetic_basic)

  1. Log in to Docker Hub using the official login guide.

  2. Find the target container ID:

    docker container list

    image.png

    The target container ID here is 6d85235bc640.

  3. 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

    image.png

  4. Push the image to Docker Hub:

    docker push <user_name>/<image_name>

    Example:

    docker push alicecc0/my_docker_noetic_basic

    image.png

Saving an Image (Example: hex_noetic_basic)

  1. Find the container ID:

    docker container list -a

    Example output:

    image.png

    The target container ID here is fc7b3cab76e6.

  2. Commit the container to an image:

    docker commit fc7b3cab76e6 hexfellow/hex-docker-noetic-basic

    image.png

  3. Save the image to a .tar file:

    docker save -o hex_docker_noetic_basic.tar hexfellow/hex-docker-noetic-basic

    image.png

  4. Verify the saved file:

    ls

    image.png

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

image.png

Script Preparation (Example: hex_noetic_basic)

  1. Create a start.sh script in the docker_shell directory:
cd ~/hex_docker/docker_shell && touch start.sh

image.png

  1. 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