DockerFile:
FROM node:4.4
MAINTAINER paas
ENV NGINX_VERSION 1.11.6-1~jessie
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
&& echo "deb nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
ca-certificates \
nginx=${NGINX_VERSION} \
nginx-module-xslt \
nginx-module-geoip \
nginx-module-image-filter \
nginx-module-perl \
nginx-module-njs \
gettext-base \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /etc/nginx/sites-enabled
# SSL Certificate Installation
ADD star_dar_kz.key /etc/ssl/
# ADD star_dar_kz.pem /etc/ssl/
# ADD dhparam.pem /etc/ssl/
# ADD nginx.conf /etc/nginx/
# ADD merchants.dar.kz.conf /etc/nginx/sites-enabled
COPY . /app
WORKDIR /app
RUN npm install --global gulp-cli
RUN npm install --global bower
RUN npm install
RUN bower --allow-root install
RUN gulp build --env prod
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
在Docker构建
之后,GPG行显示为红色,图像创建失败。为什么?
Sending build context to Docker daemon 3.072kB Step 1/16 : FROM node:4.4 ---> 93b396996a16 Step 2/16 : MAINTAINER Nurbek Sadykov ---> Using cache ---> e9a0bc967863 Step 3/16 : ENV NGINX_VERSION 1.11.6-1~jessie ---> Using cache ---> 3e87467bd365 Step 4/16 : RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb h:/nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx=${NGINX_VERSION} nginx-module-xslt nginx-module-geoip nginx-module-image-filter nginx-module-perl nginx-module-njs gettext-base curl && rm -rf /var/lib/apt/lists/* ---> Running in 93f88784bc24 Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.acoVZ86x3m --no-auto-check-trustdb --trust-model always --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 **gpg: requesting key 7BD9BF62 from hkp server pgp.mit.edu** **gpg: key 7BD9BF62: public key "nginx signing key " imported** **gpg: Total number processed: 1** **gpg: imported: 1 (RSA: 1)** - ** THIS IS INDICATED IN RED COLOR** Get:1 url InRelease [63.1 kB] Get:2 url InRelease [2865 B] Ign url jessie InRelease Get:3 url jessie-updates InRelease [145 kB] Get:4 url amd64 Packages [37.3 kB] Get:5 url jessie Release.gpg [2373 B] Get:6 urljessie Release [148 kB] Get:7 url amd64 Packages [613 kB] Get:8 url amd64 Packages [23.2 kB] Get:9 url jessie/main amd64 Packages [9063 kB] Fetched 10.1 MB in 5s (1835 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... **Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming**. The following information may help to resolve the situation: The following packages have unmet dependencies: nginx-module-geoip : Depends: nginx (= 1.13.7-1~jessie) nginx-module-image-filter : Depends: nginx (= 1.13.7-1~jessie) nginx-module-njs : Depends: nginx (= 1.13.7-1~jessie) nginx-module-perl : Depends: nginx (= 1.13.7-1~jessie) nginx-module-xslt : Depends: nginx (= 1.13.7-1~jessie) E: Unable to correct problems, you have held broken packages. The command '/bin/sh -c apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx=${NGINX_VERSION} nginx-module-xslt nginx-module-geoip nginx-module-image-filter nginx-module-perl nginx-module-njs gettext-base curl && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
DockerFile中有三个问题:
nginx-module-njs
的1.11.6-1~jessie
版本,因此需要再添加一个ENV变量。最后的Dockerfile是:
FROM node:4.4
MAINTAINER paas
ENV NGINX_VERSION 1.11.6-1~jessie
ENV NGINX_MODULE_NJS 1.11.6.0.1.4-2~jessie
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
&& echo 'deb http://nginx.org/packages/mainline/debian/ jessie nginx' >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
ca-certificates \
nginx=${NGINX_VERSION} \
nginx-module-xslt=${NGINX_VERSION} \
nginx-module-geoip=${NGINX_VERSION} \
nginx-module-image-filter=${NGINX_VERSION} \
nginx-module-perl=${NGINX_VERSION} \
nginx-module-njs=${NGINX_MODULE_NJS} \
gettext-base \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /etc/nginx/sites-enabled
# SSL Certificate Installation
ADD star_dar_kz.key /etc/ssl/
# ADD star_dar_kz.pem /etc/ssl/
# ADD dhparam.pem /etc/ssl/
# ADD nginx.conf /etc/nginx/
# ADD merchants.dar.kz.conf /etc/nginx/sites-enabled
COPY . /app
WORKDIR /app
RUN npm install --global gulp-cli
RUN npm install --global bower
RUN npm install
RUN bower --allow-root install
RUN gulp build --env prod
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
我有以下文件夹结构: 这里,我的是: 当我运行时,我希望有两个输出图像,一个用于,一个用于。 我使用(仅与版本2的语法兼容)。
本文向大家介绍Docker如何使用Dockerfile构建镜像,包括了Docker如何使用Dockerfile构建镜像的使用技巧和注意事项,需要的朋友参考一下 Dockfile是一种被Docker程序解释的脚本,Dockerfile由一条一条的指令组成,每条指令对应Linux下面的一条命令。Docker程序将这些Dockerfile指令翻译真正的Linux命令。Dockerfile有自己书写格式和
我有一个使用在本地开发中运行的项目 但是,我想知道,对于如何将一个通过和应用程序代码库运行多个服务的项目包含到一个带有的映像中进行部署,是否有任何建议或建议。 编辑:据我所知,方法是用Dockerfile从应用程序代码库中构建一个新的映像,然后将其包含在部署环境的文件中? 编辑二:对混淆表示歉意。我在码头是新的,有一点学习曲线!在这种情况下,似乎可以在gitlab注册表中构建应用程序映像,然后将该
在创建docker映像时,我想添加一个数据库和导入模式。当我尝试时,我得到了下面的错误。 160829 22:32:44 mysqld_safe日志记录到'/var/lib/mysql/2DA0903FF372.err'。160829 22:32:44 mysqld_safe从pid文件/var/run/mysqld/mysqld.pid ende d错误2002(HY000):无法通过套接字“/
问题内容: 构建Docker映像可以在桌面上正常工作。安装Node.js NPM依赖项照常工作。但是,当使用在公司代理后面托管的持续集成服务器(例如Jenkins)时,构建Docker映像将失败。 Node.js NPM依赖关系 在构建Node.js pacakges时,如果在克隆GIT依赖项时无法连接到GIT ,则命令 npm install 失败。 Java Maven,Ruby,具有依赖关系
下面我们以microservice-discovery-eureka项目为例,我们首先执行 mvn clean package # 使用Maven打包项目 将项目构建成jar包:microservice-discovery-eureka-0.0.1-SNAPSHOT.jar ,那幺如果我们想要启动项目则只需要在microservice-discovery-eureka-0.0.1-SNAPSHOT