# Replace it with the actual image version.
FROM swr.cn-south-1.myhuaweicloud.com/ascendhub/ascend-pytorch:24.0.RC3-A2-2.1.0-ubuntu20.04
# Set the user ma-user whose UID is 1000 and the user group ma-group whose GID is 100
USER root
RUN default_user=$(getent passwd 1000 | awk -F ':' '{print $1}') || echo "uid: 1000 does not exist" && \
default_group=$(getent group 100 | awk -F ':' '{print $1}') || echo "gid: 100 does not exist" && \
if [ ! -z ${default_user} ] && [ ${default_user} != "ma-user" ]; then \
userdel -r ${default_user}; \
fi && \
if [ ! -z ${default_group} ] && [ ${default_group} != "ma-group" ]; then \
groupdel -f ${default_group}; \
fi && \
groupadd -g 100 ma-group && useradd -d /home/ma-user -m -u 1000 -g 100 -s /bin/bash ma-user && \
# Grant the read, write, and execute permissions on the target directory to the user ma-user.
chmod -R 750 /home/ma-user
USER ma-user
按照要求官网的教程下载了ascend-pytorch镜像(Ubuntu 20.04版本),并在ModelArts的容器镜像管理中心进行了注册和自定义,但是始终无法启动开发环境的Notebook。
下载的镜像版本:
制作Docker时的命令为
# Replace it with the actual image version. FROM swr.cn-south-1.myhuaweicloud.com/ascendhub/ascend-pytorch:24.0.RC3-A2-2.1.0-ubuntu20.04 # Set the user ma-user whose UID is 1000 and the user group ma-group whose GID is 100 USER root RUN default_user=$(getent passwd 1000 | awk -F ':' '{print $1}') || echo "uid: 1000 does not exist" && \ default_group=$(getent group 100 | awk -F ':' '{print $1}') || echo "gid: 100 does not exist" && \ if [ ! -z ${default_user} ] && [ ${default_user} != "ma-user" ]; then \ userdel -r ${default_user}; \ fi && \ if [ ! -z ${default_group} ] && [ ${default_group} != "ma-group" ]; then \ groupdel -f ${default_group}; \ fi && \ groupadd -g 100 ma-group && useradd -d /home/ma-user -m -u 1000 -g 100 -s /bin/bash ma-user && \ # Grant the read, write, and execute permissions on the target directory to the user ma-user. chmod -R 750 /home/ma-user USER ma-user