通过dockerfile构建镜像
通过dockerfile构建镜像
通过dockerfile构建镜像dockerfile的编写规则可以参考链接和链接
dockerfile例子:
ARG IMAGE_VERSION=11111 FROM frolvlad/alpine-oraclejdk8:$IMAGE_VERSION as runner MAINTAINER 111111111@qq.com WORKDIR /home/admin/ COPY bash_profile /tmp/bash_profile RUN yum -y install XXX && \ yum clean all && \ rm -rf /usr/lib64/libstdc++.so.6 && \ cp /root/miniconda3/lib/libstdc++.so.6.0.26 /usr/lib64/ && \ ln -s /usr/lib64/libstdc++.so.6.0.26 /usr/lib64/libstdc++.so.6 USER admin RUN source /home/admin/py3/bin/activate && \ pip install cython==0.29.5 USER root
Dockerfile 的指令每执行一次都会在 docker 上新建一层。所以过多无意义的层,会造成镜像膨胀过大,以 && 符号连接命令,这样执行后,只会创建 1 层镜像
如果手中只有镜像,想查看dockerfile的内容,可以通过docker history mysql:5.7查看,但是显示不全,可以加上–no-trunc
可以使用docker build构建镜像,注意最后的点 . 这个不能少,代表dockerfile文件
另外dockerfile的默认名字为Dockerfile,默认搜索Dockerfile,如果是其他名字,
docker build -t reg.docker.alibaba-inc.com/ray_deploy/ray-deploy-ci:latest .
docker使用的时候有时候会遇到磁盘空间满了,可以参考链接
通过dockerfile构建镜像相关教程
-
linux 终止指定进程_如何在Linux中通过等待来等待指定的进程终止
linux 终止指定进程_如何在Linux中通过等待来等待指定的进程终止,而在睡眠中如何等待差异?... linux 终止指定进程 Linux provides simple and useful tools and commands. wait is one of them. We can use wait command to wait for specified process id
-
ssh密钥登录 linux_如何使用基于密钥的身份验证通过SSH通过无密
ssh密钥登录 linux_如何使用基于密钥的身份验证通过SSH通过无密码登录Linux? ssh密钥登录 linux Ssh provides secure remote connections to the remote systems. It is defacto protocol used to manage Linux and networking systems remotely via command
-
fortios 虚拟机_如何通过为管理端口设置静态IP来首次设置FortiOS
fortios 虚拟机_如何通过为管理端口设置静态IP来首次设置FortiOS或FortiGate? fortios 虚拟机 FortiGate is successful Next Generation Firewall which provides a lot of features for to day needs. The Forti family have products from WAN optimizer t
-
在webstorm中实现在vue项目中通过别名@实现点击跳转对应方法或文
在webstorm中实现在vue项目中通过别名@实现点击跳转对应方法或文件 'use strict'const path = require('path')function resolve (dir) { return path.join(__dirname, '.', dir)}module.exports = { context: path.resolve(__dirname, './'), resolve: { exte
-
Windows系统下通过Git上传项目到GitHub上的方法
Windows系统下通过Git上传项目到GitHub上的方法 在windows系统将项目代码文件上传到GitHub上去,如在Pycharm上写机器学习项目,需要将整个文件夹的代码和测试数据上传,具体可用git工具实现。 1.在GitHub上创建仓库 在官网:https://github.com/ GitHub上注册
-
linux cmake编译_在Linux中构建和编译的CMake教程
linux cmake编译_在Linux中构建和编译的CMake教程 linux cmake编译 Binaries are created by building or compiling sources like C, C++, etc. In simple applications, we can build by using the compiler like GCC directly. But this is inconvenient if
-
如何使用DockerFile为Docker容器构建映像?
如何使用DockerFile为Docker容器构建映像? Docker containers run on and made changes to images. Generally, we use existing images which is like a template to create a new container. A lot of Linux distribution and software provide serve Docke
-
windiff_如何使用windiff在Windows中通过示例比较两个文件的内容
windiff_如何使用windiff在Windows中通过示例比较两个文件的内容? windiff windiff is a tool used to compare given files contents and print the same and different lines. windiff is provided by Windows SDK Core . So in order to use this tool we