Bootstrap

【Docker】使用Dev Container进行开发

工作区 Dev Container 设置

新建一个文件夹 ./devcontainer 然后下面放 devcontainer.json

然后安装 vscode dev container 插件,然后 Ctrl+Shift+P 启动 Container

{
    "name": "PyTorch-Julia Development",
    "image": "x66ccff/pytorch-julia:2.4.1-cuda12.4-cudnn9-devel-julia1.11.2-dev",
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-python.python",
                "julialang.language-julia"
            ]
        }
    },
    "runArgs": [
        "--gpus", "all",
        "--network=host"
    ],
    "remoteUser": "root"
}

代理设置

export http_proxy="http://127.0.0.1:7897"
export https_proxy="http://127.0.0.1:7897"

提交(发行)镜像

提交镜像更改

# 创建新镜像
docker commit <container_id> username/imagename:tag

# 示例
docker commit 9120e4065e7b x66ccff/symbolicregressiongpu-jl:0.0.1

推送到 Docker Hub


# 登录Docker Hub
docker login

# 推送镜像
docker push x66ccff/symbolicregressiongpu-jl:0.0.1

更新开发容器配置

修改devcontainer.json使用新镜像:

{
    "name": "Development Environment",
    "image": "x66ccff/symbolicregressiongpu-jl:0.0.1",
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-python.python",
                "julialang.language-julia"
            ]
        }
    },
    "runArgs": ["--gpus", "all"],
    "remoteUser": "root"
}
;