# Pull the Node.js Docker image: docker pull node:22-alpine
# Create a Node.js container and start a Shell session: docker run -it --name HexoNexT -p 5000:4000 -v ~/Project/Docker/HexoNexT:/hexo --rm --entrypoint sh node:22-alpine
# warning: better not to execute `apk update` apk add --no-cache libc6-compat
# install package npm install
# generate static website (see http://localhost:5000/) npx hexo s -p 4000
# exit container exit
Dockerfile
Question
docker 进入 ubuntu 系统中运行可执行文件或并行应用,需要切换到普通用户
1 2 3 4 5 6 7 8 9 10 11
# root password passwd # create new user and set password (optional) useradd -m new_username passwd new_username cat /etc/passwd # switch user (default) su ubuntu whoami # switch root su root