Tag: dockerfile

Dockerfile包含一个写入输出文件的python脚本,但是输出文件没有在容器上创build

这是我的第一个问题,所以要温柔:) 我有一个Dockerfile如下: FROM centos:latest Maintainer Liz Miller LABEL description="Image Built with Dockerfile." RUN yum -y update RUN yum -y install python-setuptools RUN easy_install supervisor RUN mkdir -p /var/log/supervisor RUN yum -y install which RUN yum -y install git RUN yum install python COPY myscript.py myscript.py CMD ["python", "/myscript.py"] 而myscript.py python脚本是: text_file = open('output.txt', 'w') text_file.write('Hello […]

启动应用程序退出后如何继续使用docker容器?

我想创builddocker映像,在运行后启动nano编辑器,并在nanoclosures后为用户继续工作。 为此我写了下一个Dockerfile FROM ubuntu:14.04 RUN apt-get update && apt-get install -y nano RUN mkdir /home/working ENV EDITOR /bin/nano WORKDIR /home/working ENTRYPOINT /bin/nano 运行容器(docker run -it -rm test) nano后,启动nano,退出nano之后,容器closures。 closuresnano后,我想继续工作到Ubuntu的容器。 我应该改变我的Dockerfile?

在docker容器中configuration应用程序以访问其他容器

如何configuration部署为泊坞窗容器的应用程序来引用在其他容器中运行的组件? 我有一个需要postgresql的节点应用程序。 我有一个节点configuration文件,其中包含postgres的所有连接信息。 在非docker部署中,只需设置所需的configuration值(例如db服务器的IP地址等),但是如何在docker部署中完成此操作? 我使用的是Docker Compose,但是看不到如何findpostgres docker容器的必要IP地址,然后在我的node.jsconfiguration中设置该值。

Docker容器在不同的主机上改变行为

我使用不同的工具(sentinelsat et sen2cor)build造docker集装箱: #Modified Ubuntu docker image, adding some dependencies #Starting image FROM ubuntu #Install of Anaconda2-4.2.0 (from docker anaconda : https://github.com/ContinuumIO/docker-images/tree/master/anaconda) RUN apt-get update –fix-missing && apt-get install -y wget bzip2 ca-certificates \ libglib2.0-0 libxext6 libsm6 libxrender1 \ git mercurial subversion RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ wget –quiet https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh -O ~/anaconda.sh […]

我应该给tomcat通过源代码Docker卷连接的redis容器的ip地址

我是docker工的初学者。 我的源代码在xyz卷内有一个属性文件,我必须提及redis的ip地址和密码。 这里tomcat无法连接到redis这是我的docker-compose.yml version: "2" services: tomcat: container_name: tomcat build: ./tomcat ports: – "8080:8080" env_file: – ./tomcat/tomcat.env networks: – srikant-network environment: – COMPOSE_HTTP_TIMEOUT=200 volumes: – /opt/xyz:/opt/xyz depends_on: – redis – mysql – elasticsearch redis: container_name: redis build: ./redis ports: – "6379" environment: requirepass: password networks: – srikant-network elasticsearch: container_name: elasticsearch build: ./elasticsearch ports: – "9300:9300" […]

在Docker中安装Git发行版

如果我想在Docker中的Github的发行版本中安装代码,我该怎么做,占用图像中最less的空间? 目前,我已经做了这样的事情: RUN wget https://github.com/some/repo/archive/v1.5.1.tar.gz¬ RUN tar -xvzf v1.5.1.tar.gz¬ WORKDIR /unzipped-1.5.1/¬ RUN make; make install 这里的问题是最终的图像将具有下载的焦油,解压缩的版本,以及在制作过程中创build的所有内容。 我不需要这绝大多数。 如何在我的映像中安装我的库而不保留所有这些额外的数据?

如何在Dockerfile中设置ENVvariables.txt文件中的内容?

我想Dockerize一个Node.js应用程序,并在创buildDockerfile时,我遇到了连接到数据库的凭据存储在.txt文件的问题。 我怎样才能将我的Dockerfile中的.txt文件的内容设置为ENVvariables?

Dockerfile:反向卷声明

我正在根据官方docker中心的另一幅图像构build一幅图像。 图像中有一个声明为: VOLUME ["/var/lib/arangodb3", "/var/lib/arangodb3-apps"] 但是,我不想在我的形象的音量。 有没有可能,在我的Dockerfile中撤销这个卷命令?

在构builddockerfile时运行npm install时出错:npm ERR! git clone git @

在构build我的dockerfile时运行npm install时收到错误。 我不知道为什么会发生这种情况。 当我重新sorting,以便我执行“复制”。 在npm安装之前,它工作。 但我不想这样做,因为我需要重新运行npm安装每一次我重build我的图像和源代码中的每一个小的变化。 有人能告诉我为什么吗? npm安装只需要package.json运行正确? 为什么它看起来也依赖于源代码? 这是我的dockerfile: # Base docker image FROM debian:sid LABEL name="chrome-headless" \ maintainer="Justin Ribeiro <justin@justinribeiro.com>" \ version="1.4" \ description="Google Chrome Headless in a container" # Install deps + add Chrome Stable + purge all the things RUN apt-get update && apt-get install -y \ apt-transport-https \ ca-certificates \ […]

Docker用于embedded式设备

我已经是docker用户,我基本上使用docker运行服务器。 我从学校里得到了一个大项目,这个项目的目标是开发一个像Google Home一样的连接设备,但是更简单,也适合孩子们的使用:),我们有很多的库安装在我们的linux软件上,讨厌手动安装库或sh脚本。 所以,我想知道是否可以使用docker image来安装一次库,就像创build一个自定义转储一样,因此组中的每个成员只需创build映像并运行容器。 就像Linux“准备使用”一样。 当这个想法来到我这里,这显然是显而易见的,但实际上我们需要声音和video回来。 对于audio,我们发现,但我们需要驱动程序的video,几乎没有关于这个文件。 你认为docker是解决问题的好select吗? 现在是否存在更好的解决scheme? 预先感谢您的build议。