运行Docker镜像ros:kinetic时出现问题(standard_init_linux.go:211:exec用户进程导致“ exec格式错误”)

时间:2020-03-17 15:24:10

标签: linux docker ros

当尝试通过使用以下命令运行包含ros dynamic的docker镜像时遇到一些问题:

docker run --rm -it -e WORKSPACE_NAME=workspace -v $(pwd)/workspace:/root/workspace -w /root/workspace/src ros:mykinetic catkin_create_pkg beginner_tutorials std_msgs rospy

这是错误:standard_init_linux.go:211: exec user process caused "exec format error"

docker文件:

FROM ros:kinetic

COPY ./ros_entrypoint.sh /
RUN chmod +x ros_entrypoint.sh
ENTRYPOINT ["./ros_entrypoint.sh"]

文件entrypoint.sh:

#!/bin/bash
set -e

# setup ros environment
source"/opt/ros/$ROS_DISTRO/setup.bash"

# setup workspace if it exists
if [ -n "$WORKSPACE_NAME" ]; then 
    if [ ! -e "/root/$WORKSPACE_NAME/devel/setup.sh" ]; then
        previousDirectory=$(pwd)
        cd /root/$WORKSPACE_NAME
        catkin_make
        cd $previousDirectory
    fi
    source "/root/$WORKSPACE_NAME/devel/setup.sh"
fi

exec "$@"

docker build --tag ros:mykinetic .的输出:

Sending build context to Docker daemon  522.8kB
Step 1/3 : FROM ros:kinetic
 ---> 2a18fdb75229
Step 2/3 : COPY ./ros_entrypoint.sh /
 ---> cb9ec00bca0c
Step 3/3 : RUN chmod +x ./ros_entrypoint.sh
 ---> Running in 6561ca6d4904
Removing intermediate container 6561ca6d4904
 ---> 11e3b3756027
Successfully built 11e3b3756027
Successfully tagged ros:mykinetic

0 个答案:

没有答案