-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker 使用尝试 #3
Comments
实验环境 # conda create -n enspi python=3.8
# source activate enspi
# pip list
# pip install -r requirements.txt
# python -m pytest tests/fair/test_manf_exp2.py Docker 本地镜像 $ docker images
$ docker ps -a
$ docker commit <container-id> myexpt:init #fairubuntu
$ docker save -o myexpt.tar myexpt 退出后重新进入 # exit
$ docker run -it myexpt:init /bin/bash
$ docker exec -it myexpt:init /bin/bash
$ cd /home
$ source activate enspi https://zhuanlan.zhihu.com/p/348849578 |
镜像制作 (Mac) # 设置基础映像
FROM --platform=linux/amd64 ubuntu:latest
# 安装Miniconda
RUN apt-get update && apt-get install -y wget
RUN apt-get update && apt-get install vim -y 本地机 $ # 进入目录
$ cd ~ # locate Dockerfile
$ #编译镜像(默认为latest)(注意结尾一定要加.)
$ docker build -t fairgbm .
$ #编译指定版本镜像(注意结尾一定要加.)
$ docker build -t fairgbm:1.0 .
$ # 查看本地镜像 镜像列表
$ docker images 环境配置 见下 $ cd ~/Desktop
$ docker cp Miniconda3-py311_24.1.2-0-Linux-x86_64.sh <container-id>:/home
$ docker cp Miniconda3-py311_24.1.2-0-Linux-aarch64.sh <container-id>:/home
$ # docker run -it ubuntu
$ docker start <container-id>
$ docker rename <container-old-name> <new-name>
$ docker [stop][start] <container-id> # 启动/停止 镜像备份 (Mac) |
环境配置 cont. # apt-get update
# apt install vim
# apt install wget
# apt-get clean
# apt-get autoremove
# cd home && ls
# bash ./Miniconda3-py311_24.1.2-0-Linux-x86_64.sh
# bash ./Miniconda3-py311_24.1.2-0-Linux-aarch64.sh
# rm Miniconda3-py311_24.1.2-0-Linux-x86_64.sh
Do you accept the license terms? [yes|no]
>>> yes
Miniconda3 will now be installed into this location:
[/root/miniconda3] >>> /home/miniconda3
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,
run the following command when conda is activated:
conda config --set auto_activate_base false
You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>> no 配置运行环境 $ vim ~/.bashrc
# self-added by Anaconda3 installer
export PATH=/home/miniconda3/bin:$PATH
$ source ~/.bashrc
$ conda env list
$ conda create -n ensem python=3.8 其他 下载文件 |
容器使用 $ docker ps -a
$ docker stop <container-id>
$ docker start <container-id>
$ docker exec -it <container-id> /bin/bash
root@<container-id>:/# exit 资源占用查询 $ docker stats --no-stream |
Docker images 安装
本地机 (Win 11)
镜像环境
配置文件 ~/.bashrc
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
https://mirrors.aliyun.com/pypi/simple/tensorflow-gpu/
The text was updated successfully, but these errors were encountered: