标签:init docker dockers author https bcf name ase eve
# xxx快速制作镜像手册
> 本文档用于xxxx镜像包的制作
### 一、获取基准镜像
镜像包的基准镜像为: 10.0-devel-centos7
```shell
$ docker pull nvidia/10.0-devel-centos7
```
### 二、基于基准镜像启动一个容器
* 获取基准镜像ID
```shell
$ docker image list
--------------------------------------------------------------------------------------------------------
REPOSITORY TAG IMAGE ID CREATED
nvidia/cuda 10.0-devel-centos7 bcf89009b4b5 4 months ago
```
* 启动容器
```shell
$ nvidia-docker run -itd bcf89009b4b5 bash
--------------------------------------------------------------------------------------------------------
5c9e8481f657....
```
### 三、容器中构建AI预审平台
* 将全量安装包拷贝至容器中
```shell
$ docker cp ai_traffic_release_v1.1.7.8_20191010.tar.gz 5c9e8481f657:/root/
```
* 进入容器中
```shell
$ docker exec -it 5c9e8481f657 bash
```
* 解压安装包,并删除压缩包
```shell
$ cd /root/
$ tar -xzf ai_traffic_release_v1.1.7.8_20191010.tar.gz
$ rm -f ai_traffic_release_v1.1.7.8_20191010.tar.gz
```
* 构建AI预审平台
```shell
$ cd /root/
$ sh sbin/dockersh/build_image.sh
```
### 四、构建AI发布镜像(容器外操作)
* 根据容器commit镜像,5c9e8481f657 为当前容器hostname,2019101018为制作时间
```shell
$ docker commit -m="ai traffic custom docker image " --author="panie" 5c9e8481f657 aitraffic_cuda10_centos7.3_2019101018:v1.1.7.8
```
* 根据镜像ID验证镜像是否正常使用
> 启动容器,启动成功之后可直接访问服务(根据具体环境改变ip地址) https://192.168.1.16:8443/
```shell
$ nvidia-docker run -itd -p 8443:443 -p 3406:3306 bb4c4aed9372 /etc/init.d/ai_init.sh
```
* 根据commit的镜像构建镜像包
```shell
$ docker save -o aitraffic_cuda10_centos7.3_v1.1.7.8_2019101018.tar aitraffic_cuda10_centos7.3_2019101018:v1.1.7.8
```
* 将其复制到 镜像包位置
```shell
$ scp aitraffic_cuda10_centos7.3_v1.1.7.8_2019101018.tar build@192.168.2.5:/data/build/release/ai_traffic/ai_docker_image/
```
标签:init docker dockers author https bcf name ase eve
原文地址:https://www.cnblogs.com/panie2015/p/12134180.html