diff --git a/docker/README.md b/docker/README.md index 95a2940b..1ef5b459 100644 --- a/docker/README.md +++ b/docker/README.md @@ -4,21 +4,59 @@ This directory contains scripts to build the JetBot docker containers. ## Quick Start -### Step 1 - Build All Containers +### Step 1 - Configure System + +First, call the ``scripts/configure_jetson.sh`` script to configure the power mode and other parameters. + +```bash +cd jetbot +./scripts/configure_jetson.sh +``` + +Next, source the ``docker/configure.sh`` script to configure various environment variables related to JetBot docker. ```bash cd docker -./build.sh +source configure.sh +``` + +Finally, if you haven't already, set the default docker runtime to NVIDIA. This is needed to use +CUDA related components with the containers. + +```bash +./set_nvidia_runtime.sh +``` + +If needed, you can also set memory limits on the Jupyter container. + +```bash +export JETBOT_JUPYTER_MEMORY=500m +export JETBOT_JUPYTER_MEMORY_SWAP=3G ``` ### Step 2 - Enable all containers +Call the following to enable the JetBot docker containers + ```bash sudo systemctl enable docker # enable docker daemon at boot ./enable.sh $HOME # we'll use home directory as working directory, set this as you please. ``` -Now you can go to ``https://:8888`` and start programming JetBot from your web browser. -The directory you specify to ``./run.sh`` will be mounted as a volume in the jupyter container +Now you can go to ``https://:8888`` from a web browser and start programming JetBot! +You can do this from any machine on your local network. The password to log in is ``jetbot``. + +![](https://user-images.githubusercontent.com/25759564/92091965-51ae4f00-ed86-11ea-93d5-09d291ccfa95.png) + + +> Note: The directory you specify to ``./enable.sh`` will be mounted as a volume in the jupyter container at the location ``/workspace``. This means the work you in the ``/workspace`` folder inside container -is saved. Please note, if you work outside of that directory it will be lost when the container shuts down. +is saved. This is set to the root directory of Jupyter Lab. Please note, if you work outside of that directory it will be lost when the container shuts down. + +## Building Containers + +If you want to build the containers from scratch, simply call + +```bash +./build.sh +``` diff --git a/docker/base/build.sh b/docker/base/build.sh index 60f76c79..9d02a506 100755 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -10,7 +10,7 @@ fi sudo docker build \ --build-arg BASE_IMAGE=$BASE_IMAGE \ - -t jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -t $JETBOT_DOCKER_REMOTE/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile \ ../.. # jetbot repo root as context diff --git a/docker/camera/build.sh b/docker/camera/build.sh index 192476e2..461f1e22 100755 --- a/docker/camera/build.sh +++ b/docker/camera/build.sh @@ -1,4 +1,4 @@ sudo docker build \ - --build-arg BASE_IMAGE=jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ - -t jetbot/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION \ + --build-arg BASE_IMAGE=$JETBOT_DOCKER_REMOTE/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -t $JETBOT_DOCKER_REMOTE/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile . diff --git a/docker/camera/enable.sh b/docker/camera/enable.sh index 27a786c7..66e60486 100755 --- a/docker/camera/enable.sh +++ b/docker/camera/enable.sh @@ -10,4 +10,4 @@ sudo docker run -it -d \ --volume /tmp/argus_socket:/tmp/argus_socket \ --privileged \ --name=jetbot_camera \ - jetbot/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION + $JETBOT_DOCKER_REMOTE/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION diff --git a/docker/configure.sh b/docker/configure.sh index f30a5bda..5efc1d9e 100755 --- a/docker/configure.sh +++ b/docker/configure.sh @@ -1,6 +1,20 @@ #!/bin/bash -export L4T_VERSION=32.4.3 -export JETBOT_VERSION=0.4.0 +export JETBOT_VERSION=0.4.1 + +L4T_VERSION_STRING=$(head -n 1 /etc/nv_tegra_release) +L4T_RELEASE=$(echo $L4T_VERSION_STRING | cut -f 2 -d ' ' | grep -Po '(?<=R)[^;]+') +L4T_REVISION=$(echo $L4T_VERSION_STRING | cut -f 2 -d ',' | grep -Po '(?<=REVISION: )[^;]+') + +export L4T_VERSION="$L4T_RELEASE.$L4T_REVISION" + +if [[ "$L4T_VERSION" == "32.4.3" ]] +then + # docker hub + export JETBOT_DOCKER_REMOTE=jetbot +elif [[ "$L4T_VERSION" == "32.4.4" ]] +then + export JETBOT_DOCKER_REMOTE=nvcr.io/ea-linux4tegra +fi diff --git a/docker/display/build.sh b/docker/display/build.sh index 8e55e7b5..862f005f 100755 --- a/docker/display/build.sh +++ b/docker/display/build.sh @@ -1,5 +1,5 @@ sudo docker build \ - --build-arg BASE_IMAGE=jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ - -t jetbot/jetbot:display-$JETBOT_VERSION-$L4T_VERSION \ + --build-arg BASE_IMAGE=$JETBOT_DOCKER_REMOTE/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -t $JETBOT_DOCKER_REMOTE/jetbot:display-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile . diff --git a/docker/display/enable.sh b/docker/display/enable.sh index 7a279a05..d0c68e6f 100755 --- a/docker/display/enable.sh +++ b/docker/display/enable.sh @@ -4,4 +4,4 @@ sudo docker run -it -d \ --network host \ --privileged \ --name=jetbot_display \ - jetbot/jetbot:display-$JETBOT_VERSION-$L4T_VERSION + $JETBOT_DOCKER_REMOTE/jetbot:display-$JETBOT_VERSION-$L4T_VERSION diff --git a/docker/jupyter/build.sh b/docker/jupyter/build.sh index cccaee0a..ffebcabe 100755 --- a/docker/jupyter/build.sh +++ b/docker/jupyter/build.sh @@ -1,4 +1,4 @@ sudo docker build \ - --build-arg BASE_IMAGE=jetbot/jetbot:models-$JETBOT_VERSION-$L4T_VERSION \ - -t jetbot/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION \ + --build-arg BASE_IMAGE=$JETBOT_DOCKER_REMOTE/jetbot:models-$JETBOT_VERSION-$L4T_VERSION \ + -t $JETBOT_DOCKER_REMOTE/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile . diff --git a/docker/jupyter/enable.sh b/docker/jupyter/enable.sh index 79539667..9a2446bc 100755 --- a/docker/jupyter/enable.sh +++ b/docker/jupyter/enable.sh @@ -24,7 +24,7 @@ then --name=jetbot_jupyter \ --memory-swap=$JETBOT_JUPYTER_MEMORY_SWAP \ --env JETBOT_DEFAULT_CAMERA=$JETBOT_CAMERA \ - jetbot/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION + $JETBOT_DOCKER_REMOTE/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION else @@ -43,6 +43,6 @@ else --memory=$JETBOT_JUPYTER_MEMORY \ --memory-swap=$JETBOT_JUPYTER_MEMORY_SWAP \ --env JETBOT_DEFAULT_CAMERA=$JETBOT_CAMERA \ - jetbot/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION + $JETBOT_DOCKER_REMOTE/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION fi diff --git a/docker/models/build.sh b/docker/models/build.sh index 45036090..740c14b1 100755 --- a/docker/models/build.sh +++ b/docker/models/build.sh @@ -1,4 +1,4 @@ sudo docker build \ - --build-arg BASE_IMAGE=jetbot/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ - -t jetbot/jetbot:models-$JETBOT_VERSION-$L4T_VERSION \ + --build-arg BASE_IMAGE=$JETBOT_DOCKER_REMOTE/jetbot:base-$JETBOT_VERSION-$L4T_VERSION \ + -t $JETBOT_DOCKER_REMOTE/jetbot:models-$JETBOT_VERSION-$L4T_VERSION \ -f Dockerfile . diff --git a/docker/push.sh b/docker/push.sh index ce61fd01..b8666a99 100755 --- a/docker/push.sh +++ b/docker/push.sh @@ -1,5 +1,5 @@ #!/bin/bash -sudo docker push jetbot/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION -sudo docker push jetbot/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION -sudo docker push jetbot/jetbot:display-$JETBOT_VERSION-$L4T_VERSION +sudo docker push $JETBOT_DOCKER_REMOTE/jetbot:camera-$JETBOT_VERSION-$L4T_VERSION +sudo docker push $JETBOT_DOCKER_REMOTE/jetbot:jupyter-$JETBOT_VERSION-$L4T_VERSION +sudo docker push $JETBOT_DOCKER_REMOTE/jetbot:display-$JETBOT_VERSION-$L4T_VERSION diff --git a/setup.py b/setup.py index f7e6681a..29662920 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def build_libs(): setup( name='jetbot', - version='0.4.0', + version='0.4.1', description='An open-source robot based on NVIDIA Jetson Nano', packages=find_packages(), install_requires=[