如何部署一个自建的 Docker 镜像来对本地环境进行自身的更改? [英] How to deploy a self-building Docker image to make changes to itself in respect to the local environment?

查看:26
本文介绍了如何部署一个自建的 Docker 镜像来对本地环境进行自身的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单回顾一下,docker 是一种为特定 Web 服务、运行环境、虚拟机编写代码或配置文件更改的方式,所有这些都来自 linux 终端/文本文件的舒适范围.Docker 镜像是代码层的保存点,这些代码层由 dockerfile 构成,或者可以从需要基本镜像才能创建的容器中创建.Dockerfile 可作为一种自动化构建过程的方式,通过运行所有需要的命令和操作来生成任何新容器并将它们滚动到一个文件中,从而自动生成映像.

As a quick recap, docker serves as a way to write code or configuration file changes for a specific web service, run environment, virtual machines, all from the cozy confines of a linux terminal/text file. Docker Images are save points of layers of code that are made from either dockerfiles or can be created from containers which require a base image to go off of anyways to create. Dockerfiles serve as a way to automate the build process of making images by running all the desired commands and actions for any new containers to be spawned with it and roll them into one file.

现在这很好,但我想更进一步.构建镜像,尤其是那些有依赖关系的镜像很麻烦,因为 1,你必须依赖默认操作系统镜像中不存在的命令,或者 2,有很多其他不需要的无用命令.

Now this is great and all but i want to take this a step further. Building images, especially those with dependencies are encumbersome because 1,you have to rely on commands that are either not there within the default OS image, or 2, have a lot of other useless commands to which are not needed.

现在在我的脑海中,我觉得这是可能的,但我还不能建立联系.我的愿望是让 dockerfile 从头开始​​构建自己(字面意思是从头开始的图像)并根据自己构建自己.它是复制任何所需的依赖项,例如 rpm 或其他东西,安装它,找到它的启动命令,并将成功创建和运行映像所需的所有依赖项传递回 docker 文件. 在编程意义上,

Now in my head i feel like its possible but i cant make the connection just yet. My desire is to get a dockerfile to build itself from scratch (Litterally the image of scratch) and build itself according. It is to copy any dependencies that is desired so like an rpm or something, install it, find its start up command, and relay all dependencies thats needed to succesfully create and run the image with no flaw back to the docker file. In a programming sense,

FROM scratch
COPY package.rpm
RUN *desired cmds*

运行错误被反馈到一个文件中.file 在当前操作系统中搜索所需的依赖项并将它们返回给 RUN cmd.

Run errors are fed back into a file. file searchs the current OS for the dependencies needed and returns them to the RUN cmd.

CMD *service start up*

至于该 CMD,我们将运行该服务,并获取其状态并将其过滤回其启动命令返回 CMD 部分.

As for that CMD, we would run the service, and get its status and filter it back its startup commands back into the CMD portion.

这里的问题是我不相信我可以使用 docker 来达到这些目的.要对某物进行 docker 构建,保留其错误并将其再次过滤回构建中似乎具有挑战性.我希望 docker 可以配备此功能,因为我执行此类任务的唯一机会似乎是通过对可移植性因素造成严重破坏的脚本.

The problem here though is that i dont believe i can use docker to these ends. To do a docker build of something, retain its errors and filter it back into the build again seems challenging. I wish docker could come equipped with this as it would seem like my only chance of performing such a task would be through a script which wreaks havoc on the portability factor.

有什么想法吗?

推荐答案

对我来说,这听起来更像是一个供应系统、厨师或傀儡.如果您必须留在码头区,我知道有些人会使用它们来创建图像.

Sounds more like a provisioning system a la ansible, chef or puppet to me. I know some use those to create images if you have to stay in the dockerland.

这篇关于如何部署一个自建的 Docker 镜像来对本地环境进行自身的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆