chdir to cwd (\”/var/www/html\”) set in config.json failed: no such file or directory
# docker exec -it a90277f94f02 id OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/var/www/html\") set in config.json failed: no such file or directory": unknown
查看容器 WorkingDir
# docker inspect --format '{{ .Config.WorkingDir }}' a90277f94f02 /var/www/html
查看 容器 /var/www/html 目录不存在
# ls /data0/docker/devicemapper/mnt/c7c26ea15c244b56e156f1e816ccb38ba6ca14324d3b9d58d78900c657523fee/rootfs/var/www/html ls: cannot access /data0/docker/devicemapper/mnt/c7c26ea15c244b56e156f1e816ccb38ba6ca14324d3b9d58d78900c657523fee/rootfs/var/www/html: No such file or directory
docker exec 执行 -w 参数
# docker exec --help Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...] Run a command in a running container Options: -d, --detach Detached mode: run command in the background --detach-keys string Override the key sequence for detaching a container -e, --env list Set environment variables -i, --interactive Keep STDIN open even if not attached --privileged Give extended privileges to the command -t, --tty Allocate a pseudo-TTY -u, --user string Username or UID (format: <name|uid>[:<group|gid>]) -w, --workdir string Working directory inside the container
创建 /var/www/html
# docker exec -w /root -it a90277f94f02 mkdir /var/www/html
# docker exec -it a90277f94f02 id uid=0(root) gid=0(root) groups=0(root)
转载请注明:爱开源 » chdir to cwd (\”/var/www/html\”) set in config.json failed: no such file or directory