docker-compose

Docker compose and external images multi-stage builds

拈花ヽ惹草 提交于 2019-12-22 10:58:04
问题 I use Docker multi-stage build, specifically: Use an external image as a “stage” When using multi-stage builds, you are not limited to copying from stages you created earlier in your Dockerfile. You can use the COPY --from instruction to copy from a separate image, either using the local image name, a tag available locally or on a Docker registry, or a tag ID. The Docker client pulls the image if necessary and copies the artifact from there. The syntax is: In my case I have three Docker files

go get in Dockerfile. I got cannot find package error

*爱你&永不变心* 提交于 2019-12-22 10:53:07
问题 I added RUN go get to install packages during "docker-compose". However, the following cannot find package error was occurred when I run go build . I found that the packages are saved in /go/pkg/linux_amd64/ . run docker-compose and go build $ docker-compose up -d $ docker exec -it explorer-cli /bin/bash # pwd /go # ls bin pkg src # echo $GOPATH /go # ls /go/pkg/linux_amd64/github.com/ go-sql-driver # go build -i -o /go/bin/explorer-cli src/main.go src/main.go:6:2: cannot find package "github

Docker - how to set up Apache + PHP in docker-compose.yml

余生长醉 提交于 2019-12-22 10:24:08
问题 I use this to set up nginx for PHP: nginx: image: nginx:latest ports: - 8080:80 volumes: - ./code:/code - ./site.conf:/etc/nginx/conf.d/site.conf links: - php php: image: php:7-fpm volumes: - ./code:/code But how about Apache? How can I set up Apache + PHP in docker-compose.yml? Following this guide: version: '2' services: php: build: php ports: - "80:80" - "443:443" volumes: - ./php/www:/var/www/html Error: ERROR: In file './docker-compose.yml' service 'version' doesn't have any

Docker: container can't find domain on private network

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 10:23:11
问题 I'm trying to figure out a problem with identical docker containers being run on different hosts, where one container can find/ping/nslookup a domain on a private network, and another can't. One host is OSX 10.11, the other is Ubuntu 16.04. Both are running docker 1.12. I'm using docker-compose to bring up my application, and I'm hoping to figure out what is going on and how to fix it, or some configuration changes I could make without resorting to hardcoding domains or ip addresses that

Docker compose missing yarn dependencies on build

拟墨画扇 提交于 2019-12-22 10:02:23
问题 Can't get node_modules folder when running yarn install in the Dockerfile test-sof ├── docker-compose.yml ├── Dockerfile ├── package.json └── yarn.lock docker-compose.yml version: '3' services: web: build: . volumes: - .:/myapp package.json { "name": "site", "private": true, "dependencies": { "@rails/webpacker": "^3.2.1", "babel-preset-react": "^6.24.1", "prop-types": "^15.6.0", "react": "^16.2.0", "react-dom": "^16.2.0", "reactjs": "^1.0.0", "underscore": "^1.8.3" }, "devDependencies": {

How to extend service in Docker Compose V3?

血红的双手。 提交于 2019-12-22 09:39:19
问题 I have a docker-compose.yml which looks like version: '2' services: redis: image: redis mysqldb: image: mysql:5.7 environment: - MYSQL_ROOT_PASSWORD=passme - MYSQL_DATABASE=mydb - MYSQL_USER=root base: build: . volumes: - .:/proj environment: - ENV_1=Value_1 - ENV_2=Value_2 - ENV_3=Value_3 worker: extends: service: base command: celery -A proj worker --loglevel=debug links: - redis - mysqldb depends_on: - mysqldb web: extends: service: base links: - mysqldb - redis depends_on: - mysqldb ports

How to setup unit test in Docker for nodejs application?

时间秒杀一切 提交于 2019-12-22 08:55:59
问题 I am trying to run mocha unit test for my node application. The application is built by a docker image. Docker image: FROM node:6.10.0-alpine RUN mkdir -p /app WORKDIR /app COPY package.json /app RUN npm install COPY . /app EXPOSE 3000 CMD ["npm", "start"] Docker compose: version: "3" services: web: #### nodejs image build: . volumes: - ./app/ ports: - "3000:3000" depends_on: - db db: build: ##### postgres db image context: . dockerfile: dbDockerfile ports: - 5432:5432 The setup can be built

Error 99 connecting to localhost:6379. Cannot assign requested address

荒凉一梦 提交于 2019-12-22 08:54:36
问题 Setup: I have a virtual machine and in the virtual machine running three containers (an nginx proxy, a very minimalistic flask app and redis). Flask should be serving on port 5000 while redis on 6379. Each of these containers are up and running just fine as stand a lone services, but also available via docker compose as a service . In the flask app, my aim is to connect to redis and query for some keys. The nginx container exposes port 80, flask port 5000 and redis port 6379. In the flask app

Docker doesn't resolve hostname

主宰稳场 提交于 2019-12-22 08:29:06
问题 I need to know the hostnames (or ip addresses) of some container running on the same machine. As I already commented here (but with no answer yet), I use docker-compose . The documentation says, compose will automatically create a hostname entry for all container defined in the same docker-compose.yml file: Each container for a service joins the default network and is both reachable by other containers on that network, and discoverable by them at a hostname identical to the container name.

Error running containers with docker-compose, error pulling images from my private repo in dockerhub

非 Y 不嫁゛ 提交于 2019-12-22 08:25:09
问题 I have 3 images pushed on my private repository in docker hub. Locally, the way I've always run the 3 images is via docker-compose up -d, and it works. Now I'm trying to run this images in a different server so I pushed them in a private repository in docker hub. So in order to run them in the new server this is what I do: 1- I run docker login with my docker hub credentials WARNING! Your password will be stored unencrypted in /home/user/.docker/config.json. Configure a credential helper to