vnc - 在Linux容器中使用 super 用户启动vncserver

标签 vnc supervisord docker lxc

我正在尝试在lxc容器启动时使用 super 用户来启动vncserver(我认为成为容器并不重要)。问题是计算机以root用户身份启动。我的监督程序部分如下所示:

[program:vnc]
directory=/
user=ubuntu
environment=HOME="/home/ubuntu",USER="ubuntu"
priority=901
command=/usr/bin/vncserver -fg -geometry 1024x768 :1

但是,尽管/home/ubuntu/.vnc/passwd中已经存在一个密码,但是我发现日志文件显示了它试图创建密码的过程。

想知道我是否缺少什么?用户不是应该在运行命令之前更改用户$ HOME和$ USER吗?

最佳答案

您可以定义运行具有特定用户名(如果有的话)或UID的容器,而镜像/容器中没有任何现有用户。

Docker文档:https://docs.docker.com/engine/reference/run/#user

USER

root (id = 0) is the default user within a container. The image developer can create additional users. Those users are accessible by name. When passing a numeric ID, the user does not have to exist in the container.

The developer can set a default user to run the first process with the Dockerfile USER instruction. When starting a container, the operator can override the USER instruction by passing the -u option.

-u="": Username or UID

Note: if you pass a numeric uid, it must be in the range of 0-2147483647.

关于vnc - 在Linux容器中使用 super 用户启动vncserver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19168058/

相关文章:

vnc - 使用多台显示器全屏运行VNC

linux - supervisord 仅从根目录运行

docker - Prisma 在运行 Prisma init 时不生成文件

docker - 如何在Alpine上提交更改?

python - 未在 supervisord 下执行的线程

docker 拉 - 标准错误 : layers from manifest don't match image configuration

android - 如何防止 droid VNC 服务器上的键盘缓冲

java - 为什么 VNC 服务器不提供多屏幕功能?

iphone - iPhone 的 vnc 应用程序。如何着手构建一个?

python - 停止主管不会停止 celery worker