Cant build Docker image on host machine with x86_64

When I type ./scripts/run_dev.sh ${ISAAC_ROS_WS}

Building x86_64.ros2_humble.user base as image: isaac_ros_dev-x86_64 using key x86_64.ros2_humble.user
Using base image name not specified, using ''
Using docker context dir not specified, using Dockerfile directory
Failed to build base image: isaac_ros_dev-x86_64, aborting.

How to solve this?

What is the directory layout of your workspace? Could you edit run_dev.sh to add the “-X” option to print out verbose commands being invoked?

~/workspace/isaac_ros-dev

.
└── src
    └── isaac_ros_common
        ├── docker
        │   ├── middleware_profiles
        │   ├── patches
        │   ├── scripts
        │   ├── tao
        │   └── udev_rules
        ├── isaac_ros_apriltag_interfaces
        │   └── msg
        ├── isaac_ros_bi3d_interfaces
        │   └── msg
        ├── isaac_ros_common
        │   ├── cmake
        │   │   └── modules
        │   ├── include
        │   │   └── isaac_ros_common
        │   └── src
        ├── isaac_ros_nitros_bridge_interfaces
        │   └── msg
        ├── isaac_ros_nova_interfaces
        │   └── msg
        ├── isaac_ros_pointcloud_interfaces
        │   └── msg
        ├── isaac_ros_tensor_list_interfaces
        │   └── msg
        ├── isaac_ros_test
        │   ├── isaac_ros_test
        │   │   └── examples
        │   ├── resource
        │   └── test
        └── scripts
            └── utils


By the way, when i add -X option at run_dev.sh it return wrong

Specified isaac_ros_dev does not exist: -X

Debug information of docker

INFO[2024-01-06T08:58:54.836252434+08:00] API listen on /var/run/docker.sock           
DEBU[2024-01-06T08:59:08.991390649+08:00] Calling HEAD /_ping                          
DEBU[2024-01-06T08:59:08.991570371+08:00] Calling GET /v1.43/containers/json           
DEBU[2024-01-06T08:59:09.008706020+08:00] Calling HEAD /_ping                          
DEBU[2024-01-06T08:59:09.008877172+08:00] Calling GET /v1.43/containers/json?all=1&filters=%7B%22name%22%3A%7B%22isaac_ros_dev-x86_64-container%22%3Atrue%7D%2C%22status%22%3A%7B%22exited%22%3Atrue%7D%7D 
DEBU[2024-01-06T08:59:09.016439843+08:00] Calling HEAD /_ping                          
DEBU[2024-01-06T08:59:09.016605455+08:00] Calling GET /v1.43/containers/json?all=1&filters=%7B%22name%22%3A%7B%22isaac_ros_dev-x86_64-container%22%3Atrue%7D%2C%22status%22%3A%7B%22running%22%3Atrue%7D%7D 

Thanks, but I meant add “-x” to the first line of the shell script build_base_image.sh:
#!/bin/bash -ex or add the line set -x to the script. Instead of editing the shell script, though, you can invoke it as follows:
bash -xv scripts/run_dev.sh

That should print out all of the command lines that bash invokes in the script. One such command is returning a non-zero return value inside of build_base_image.sh which is terminating early because it has “-e” bash option set. The verbose output should let us narrow down which command is failing.

Thank you, here is the result of bash -xv scripts/run_dev.sh command

#!/bin/bash
#
# Copyright (c) 2021-2022, NVIDIA CORPORATION.  All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.

ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+++ dirname scripts/run_dev.sh
++ cd scripts
++ pwd
+ ROOT=/home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common/scripts
source $ROOT/utils/print_color.sh
+ source /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common/scripts/utils/print_color.sh
#!/bin/bash -e
#
# Copyright (c) 2021, NVIDIA CORPORATION.  All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.

function print_color {
    tput setaf $1
    echo "$2"
    tput sgr0
}

function print_error {
    print_color 1 "$1"
}

function print_warning {
    print_color 3 "$1"
}

function print_info {
    print_color 2 "$1"
}

function usage() {
    print_info "Usage: run_dev.sh" {isaac_ros_dev directory path OPTIONAL}
    print_info "Copyright (c) 2021-2022, NVIDIA CORPORATION."
}

# Read and parse config file if exists
#
# CONFIG_IMAGE_KEY (string, can be empty)

if [[ -f "${ROOT}/.isaac_ros_common-config" ]]; then
    . "${ROOT}/.isaac_ros_common-config"
fi
+ [[ -f /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common/scripts/.isaac_ros_common-config ]]

ISAAC_ROS_DEV_DIR="$1"
+ ISAAC_ROS_DEV_DIR=
if [[ -z "$ISAAC_ROS_DEV_DIR" ]]; then
    ISAAC_ROS_DEV_DIR_DEFAULTS=("$HOME/workspaces/isaac_ros-dev" "/workspaces/isaac_ros-dev")
    for ISAAC_ROS_DEV_DIR in "${ISAAC_ROS_DEV_DIR_DEFAULTS[@]}"
    do
        if [[ -d "$ISAAC_ROS_DEV_DIR" ]]; then
            break
        fi
    done

    if [[ ! -d "$ISAAC_ROS_DEV_DIR" ]]; then
        ISAAC_ROS_DEV_DIR=$(realpath "$ROOT/../")
    fi
    print_warning "isaac_ros_dev not specified, assuming $ISAAC_ROS_DEV_DIR"
else
    if [[ ! -d "$ISAAC_ROS_DEV_DIR" ]]; then
        print_error "Specified isaac_ros_dev does not exist: $ISAAC_ROS_DEV_DIR"
        exit 1
    fi
    shift 1
fi
+ [[ -z '' ]]
+ ISAAC_ROS_DEV_DIR_DEFAULTS=("$HOME/workspaces/isaac_ros-dev" "/workspaces/isaac_ros-dev")
+ for ISAAC_ROS_DEV_DIR in "${ISAAC_ROS_DEV_DIR_DEFAULTS[@]}"
+ [[ -d /home/kaln/workspaces/isaac_ros-dev ]]
+ for ISAAC_ROS_DEV_DIR in "${ISAAC_ROS_DEV_DIR_DEFAULTS[@]}"
+ [[ -d /workspaces/isaac_ros-dev ]]
+ [[ ! -d /workspaces/isaac_ros-dev ]]
++ realpath /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common/scripts/../
+ ISAAC_ROS_DEV_DIR=/home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common
+ print_warning 'isaac_ros_dev not specified, assuming /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common'
+ print_color 3 'isaac_ros_dev not specified, assuming /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common'
+ tput setaf 3
+ echo 'isaac_ros_dev not specified, assuming /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common'
isaac_ros_dev not specified, assuming /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common
+ tput sgr0

ON_EXIT=()
+ ON_EXIT=()
function cleanup {
    for command in "${ON_EXIT[@]}"
    do
        $command
    done
}
trap cleanup EXIT
+ trap cleanup EXIT

pushd . >/dev/null
+ pushd .
cd $ROOT
+ cd /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common/scripts
ON_EXIT+=("popd")
+ ON_EXIT+=("popd")

# Prevent running as root.
if [[ $(id -u) -eq 0 ]]; then
    print_error "This script cannot be executed with root privileges."
    print_error "Please re-run without sudo and follow instructions to configure docker for non-root user if needed."
    exit 1
fi
++ id -u
+ [[ 1000 -eq 0 ]]

# Check if user can run docker without root.
RE="\<docker\>"
+ RE='\<docker\>'
if [[ ! $(groups $USER) =~ $RE ]]; then
    print_error "User |$USER| is not a member of the 'docker' group and cannot run docker commands without sudo."
    print_error "Run 'sudo usermod -aG docker \$USER && newgrp docker' to add user to 'docker' group, then re-run this script."
    print_error "See: https://docs.docker.com/engine/install/linux-postinstall/"
    exit 1
fi
++ groups kaln
+ [[ ! kaln : kaln adm cdrom sudo dip plugdev lpadmin lxd sambashare docker =~ \<docker\> ]]

# Check if able to run docker commands.
if [[ -z "$(docker ps)" ]] ;  then
    print_error "Unable to run docker commands. If you have recently added |$USER| to 'docker' group, you may need to log out and log back in for it to take effect."
    print_error "Otherwise, please check your Docker installation."
    exit 1
fi
++ docker ps
+ [[ -z CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES ]]

# Check if git-lfs is installed.
git lfs &>/dev/null
+ git lfs
if [[ $? -ne 0 ]] ; then
    print_error "git-lfs is not insalled. Please make sure git-lfs is installed before you clone the repo."
    exit 1
fi
+ [[ 0 -ne 0 ]]

# Check if all LFS files are in place in the repository where this script is running from.
cd $ROOT
+ cd /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common/scripts
git rev-parse &>/dev/null
+ git rev-parse
if [[ $? -eq 0 ]]; then
    LFS_FILES_STATUS=$(cd $ISAAC_ROS_DEV_DIR && git lfs ls-files | cut -d ' ' -f2)
    for (( i=0; i<${#LFS_FILES_STATUS}; i++ )); do
        f="${LFS_FILES_STATUS:$i:1}"
        if [[ "$f" == "-" ]]; then
            print_error "LFS files are missing. Please re-clone the repo after installing git-lfs."
            exit 1
        fi
    done
fi
+ [[ 0 -eq 0 ]]
++ cd /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common
++ git lfs ls-files
++ cut -d ' ' -f2
+ LFS_FILES_STATUS='*'
+ (( i=0 ))
+ (( i<1 ))
+ f='*'
+ [[ * == \- ]]
+ (( i++  ))
+ (( i<1 ))

PLATFORM="$(uname -m)"
++ uname -m
+ PLATFORM=x86_64

BASE_NAME="isaac_ros_dev-$PLATFORM"
+ BASE_NAME=isaac_ros_dev-x86_64
CONTAINER_NAME="$BASE_NAME-container"
+ CONTAINER_NAME=isaac_ros_dev-x86_64-container

# Remove any exited containers.
if [ "$(docker ps -a --quiet --filter status=exited --filter name=$CONTAINER_NAME)" ]; then
    docker rm $CONTAINER_NAME > /dev/null
fi
++ docker ps -a --quiet --filter status=exited --filter name=isaac_ros_dev-x86_64-container
+ '[' '' ']'

# Re-use existing container.
if [ "$(docker ps -a --quiet --filter status=running --filter name=$CONTAINER_NAME)" ]; then
    print_info "Attaching to running container: $CONTAINER_NAME"
    docker exec -i -t -u admin --workdir /workspaces/isaac_ros-dev $CONTAINER_NAME /bin/bash $@
    exit 0
fi
++ docker ps -a --quiet --filter status=running --filter name=isaac_ros_dev-x86_64-container
+ '[' '' ']'

# Build image
IMAGE_KEY=ros2_humble
+ IMAGE_KEY=ros2_humble
if [[ ! -z "${CONFIG_IMAGE_KEY}" ]]; then
    IMAGE_KEY=$CONFIG_IMAGE_KEY
fi
+ [[ ! -z '' ]]

BASE_IMAGE_KEY=$PLATFORM.user
+ BASE_IMAGE_KEY=x86_64.user
if [[ ! -z "${IMAGE_KEY}" ]]; then
    BASE_IMAGE_KEY=$PLATFORM.$IMAGE_KEY

    # If the configured key does not have .user, append it last
    if [[ $IMAGE_KEY != *".user"* ]]; then
        BASE_IMAGE_KEY=$BASE_IMAGE_KEY.user
    fi
fi
+ [[ ! -z ros2_humble ]]
+ BASE_IMAGE_KEY=x86_64.ros2_humble
+ [[ ros2_humble != *\.\u\s\e\r* ]]
+ BASE_IMAGE_KEY=x86_64.ros2_humble.user

print_info "Building $BASE_IMAGE_KEY base as image: $BASE_NAME using key $BASE_IMAGE_KEY"
+ print_info 'Building x86_64.ros2_humble.user base as image: isaac_ros_dev-x86_64 using key x86_64.ros2_humble.user'
+ print_color 2 'Building x86_64.ros2_humble.user base as image: isaac_ros_dev-x86_64 using key x86_64.ros2_humble.user'
+ tput setaf 2
+ echo 'Building x86_64.ros2_humble.user base as image: isaac_ros_dev-x86_64 using key x86_64.ros2_humble.user'
Building x86_64.ros2_humble.user base as image: isaac_ros_dev-x86_64 using key x86_64.ros2_humble.user
+ tput sgr0
$ROOT/build_base_image.sh $BASE_IMAGE_KEY $BASE_NAME '' '' ''
+ /home/kaln/workspace/isaac_ros-dev/src/isaac_ros_common/scripts/build_base_image.sh x86_64.ros2_humble.user isaac_ros_dev-x86_64 '' '' ''
Using base image name not specified, using ''
Using docker context dir not specified, using Dockerfile directory

if [ $? -ne 0 ]; then
    print_error "Failed to build base image: $BASE_NAME, aborting."
    exit 1
fi
+ '[' 1 -ne 0 ']'
+ print_error 'Failed to build base image: isaac_ros_dev-x86_64, aborting.'
+ print_color 1 'Failed to build base image: isaac_ros_dev-x86_64, aborting.'
+ tput setaf 1
+ echo 'Failed to build base image: isaac_ros_dev-x86_64, aborting.'
Failed to build base image: isaac_ros_dev-x86_64, aborting.
+ tput sgr0
+ exit 1
cleanup
+ cleanup
+ for command in "${ON_EXIT[@]}"
+ popd



Looks like I just turn off my GPU.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.