docker 安装linux子系统

首页 / 默认分类 / 正文

使用基于 Web 的桌面环境(推荐)

mkdir -p ~/webtop/config && docker stop webtop 2>/dev/null; docker rm webtop 2>/dev/null; docker run -d --name webtop -p 8080:3000 -v ~/webtop/config:/config --shm-size 2gb -e PUID=$(id -u) -e PGID=$(id -g) -e TZ=Asia/Shanghai -e CUSTOM_USER=admin -e PASSWORD=123456 --restart unless-stopped lscr.io/linuxserver/webtop:ubuntu-xfce

DockFile

FROM lscr.io/linuxserver/webtop:ubuntu-xfce

# 元数据
LABEL maintainer="your-name@example.com"
LABEL description="Custom Webtop with additional packages"

# 环境变量(基础镜像会自动处理用户创建)
ENV TZ=Asia/Shanghai
ENV CUSTOM_USER=admin
ENV PASSWORD=123456

# 暴露端口
EXPOSE 3000

# 卷声明
VOLUME ["/config"]

# 更新系统并安装额外软件
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    curl \
    wget \
    vim \
    htop \
    net-tools \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# 创建工作目录
WORKDIR /config

# 健康检查(修正拼写错误)
HEALTHCHECK --interval=60s --timeout=10s --start-period=120s --retries=3 \
    CMD curl -f http://localhost:3000 || exit 1
无标签
评论区
头像