Det ser ud til, at du trækker et billede i stedet for at bygge dit eget image.
I stedet for image: golang:1.7
erstatte det med build: .
at bygge og bruge din Dockerfile
.
Du skal muligvis også sende postgres miljøvariabler DB_HOST
, DB_USER
, DB_PASS
osv. du kan opnå det, men at oprette for eksempel docker.env
fil, og tilføj derefter env_file
under din go-app docker-compose.yml
fil:
Eksempel docker.env :
DB_HOST=postgres
DB_USER=user
DB_PASS=pass
DB_NAME=mydb
Rettet docker-compose.yml :
version: '2'
services:
app:
build: .
volumes:
- ./:/server/http
ports:
- "80:8080"
links:
- postgres
- mongodb
- redis
environment:
DEBUG: 'true'
PORT: '8080'
env_file:
- docker.env
postgres:
image: onjin/alpine-postgres:9.5
restart: unless-stopped
ports:
- "5432:5432"
environment:
LC_ALL: C.UTF-8
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: mydb
mongodb:
image: mvertes/alpine-mongo:3.2.3
restart: unless-stopped
ports:
- "27017:27017"
redis:
image: sickp/alpine-redis:3.2.2
restart: unless-stopped
ports:
- "6379:6379"