Tag: docker compose

Docker-在Mac上编写extra_hosts

我试图添加一个新的主机到我的Nginx容器与Docker-compose的extra_hostsconfiguration。 出于某种原因,我不能使它工作。 我使用Docker for Mac 17.06 CE和Docker-Compose v3稳定。 这是我的configuration: nginx: build: ./docker/nginx container_name: nginx ports: – '80:80' volumes: – "${PROJECT_ROOT}:/var/www/html:ro" networks: – server extra_hosts: – 'test.local:127.0.0.1' depends_on: – php restart: always 我也尝试添加额外的主机与我的Mac的IP,但它不响应。 UPDATE 出于某种原因,您需要编辑Mac上的/ etc / hosts文件来添加新的主机。 extra_hostsconfiguration什么都不做。

如何在docker centos 6映像上启动postgres 9.6服务

我相当新的docker组成,我试图build立一个与centos 6上的postgres 9.6的容器和运行与docker组成。 然后我想能够通过一些数据库pipe理工具连接到数据库。 如果我运行: docker-compose up 图像生成正确,但我无法连接到数据库。 如果我删除了tty:true和stdin_open:true,则图像会生成,但是会退出,退出代码为0 如果我运行docker-run -it -p 5432:5432 –entypoint / bin / bash [image_name],然后手动运行命令服务postgresql-9.6 start everything works(until I exit the container)。 任何build议? 这是我的docker-compose文件: networks{} version: '2' services: postgres: build: context: ./src/test/docker/postgres ports: – "5432:5432" stdin_open: true tty: true 和我的docker文件: FROM centos:6 RUN yum -y install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg- centos96-9.6-3.noarch.rpm RUN yum -y […]

无法连接到数据库:错误getaddrinfo ENOTFOUND db db:3306

文件结构: APP ├─ API │ └─ Dockerfile.yml ├─ db │ └─ storage └─ docker-compose.yml 我还没有数据库的地方: Dockerfile.yml: # Base node image FROM node:8.2.1 # ON DOCKER CONTAINER WORKDIR /API # Install nodemon to monitor changes to the app. RUN npm install -g nodemon COPY package.json /API/package.json RUN npm install && npm ls RUN mv /API/node_modules /node_modules […]

如何从Dockerfile shell脚本中的.env文件获取环境variables值?

我如何在shell脚本中访问.env文件中定义的环境variables? .env文件 USERNAME=user PASSWORD=pass Dockerfile …. COPY ./compose/django/celery/worker/start_celery_flower.sh /start_celery_flower.sh RUN sed -i 's/\r//' /start_celery_flower.sh RUN chmod +x /start_celery_flower.sh …. 我尝试在shell脚本中使用$USERNAME ,但这不起作用。 我能够在容器内运行的应用程序中访问这些variables。

获取权限拒绝/ bin / sh启动生产中的服务器| 泊坞窗,撰写

我正在生产服务器上运行sudo docker-compose来启动我的Go容器。 我有我的生产服务器sudo访问,但不是根用户。 错误: go_1 | /bin/sh: ./: Permission denied 泊坞窗,compose.yml go: build: context: ./api args: app_env: ${APP_ENV} volumes: – ./api:/go/src/myproject/api expose: – "8080" 去Dockerfile From golang:1.8.3-alpine3.6 RUN apk update && \ apk add \ bash \ build-base \ curl \ make \ git \ && rm -rf /var/cache/apk/* ARG app_env ENV APP_ENV $app_env COPY […]

Dotnet core 2 docker:找不到可执行的匹配命令“dotnet-watch”

我正在尝试为dotnet core 2创build一个开发Dockerfile 。到目前为止,我有以下内容: FROM microsoft/aspnetcore-build:2.0 VOLUME /app WORKDIR /app COPY . ./ ENV ASPNETCORE_SERVER.URLS http://*:5000 ENV ASPNETCORE_ENVIRONMENT Development RUN dotnet restore ENTRYPOINT dotnet watch run –configuration Debug 如果我运行: dotnet restore dotnet watch run 从同一个文件夹,一切似乎都工作得很好(观察者开始)。 当我运行该docker文件(在docker-compose环境中)时,它一直在喊: 找不到可执行的匹配命令“dotnet-watch” 我的configuration文件如下: <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> </PropertyGroup> <ItemGroup> <Folder Include="wwwroot\" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" […]

如果设置了variables,如何configurationdocker组合使用给定的子网,或者如果不是,select自己?

我在我的泊坞窗撰写文件中有以下networkingconfiguration。 networks: default: ipam: driver: default config: – subnet: ${DOCKER_SUBNET} 当设置DOCKER_SUBNET ,按照预期使用该variables中指定的子网。 当variables没有设置,我得到: ERROR: Invalid subnet : invalid CIDR address:因为variables是空白的(这是完全合理的)。 有没有一种方法来configurationipam驱动程序,如果没有设置DOCKER_SUBNETvariables, DOCKER_SUBNET -compose将select一个可用的子网,如果没有给出ipamconfiguration,通常会这样做?

run_web.sh找不到,即使它在目录中吗?

我刚刚安装了Docker,在设置了Python,Django等一些东西之后,在我的Web服务器运行之前,我得到了一个错误。 为了让Web服务器运行,我写了一个名为run_web.sh的脚本。 它也在docker-compose.yml中configuration来运行web服务器,运行命令exec run_web.sh 。 执行该命令时,会抛出如下错误: Starting portalapi_web_1 … error ERROR: for portalapi_web_1 Cannot start service web: oci runtime error: container_linux.go:265: starting container process caused "exec: \"./run_web.sh\": stat ./run_web.sh: no such file or directory" ERROR: for web Cannot start service web: oci runtime error: container_linux.go:265: starting container process caused "exec: \"./run_web.sh\": stat ./run_web.sh: no such […]

Docker节点:无法find入口点

我有以下Dockerfile_dev泊坞窗文件: FROM node:alpine MAINTAINER "Desyllas Dimitrios" ENV NEO4J_HOST="" ENV NEO4J_USER="" ENV NEO4J_PASSWORD="" ENV MONGO_CONNECTION_STRING="" ENV LOGS_DIR="/var/log/data_map" COPY ./docker_scripts/entrypoint_dev.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh &&\ chown root:root /usr/local/bin/entrypoint.sh &&\ mkdir -p /opt/map &&\ mkdir -p /var/log/data_map &&\ chmod 0666 /var/log/data_map EXPOSE 7474 VOLUME /var/log/data_map VOLUME /opt/map WORKDIR /opt/map ENTRYPOINT ['/usr/local/bin/entrypoint.sh'] 我有以下的入口点: #!/bin/sh cd /opt/map npm install […]

Docker:在CLI上运行dotnet发布-o / output会导致非零的错误

我使用的是Ubuntu 16.04 LTS, Docker-compose v 1.18.0-rc2, build 189468b Docker version 17.12.0-ce-rc1, build ee2f943 运行这个命令: dotnet发布带docker的-o / output会导致这个错误: ERROR: Service 'generator' failed to build: The command '/bin/sh -c dotnet publish -c Release -o out' returned a non-zero code: 145 我已经安装了Ubuntu的.NET SDK,不知道如何解决这个错误; 它只是不会创build该发布文件夹; 这里是dotnet –info joel @ worker-2:〜/ workspace / asp(copy)/ api $ dotnet –info .NET命令行工具(2.0.2) 产品信息:版本:2.0.2提交SHA-1哈希:a04b4bf512 […]