Closed MikeTheCanuck closed 7 years ago
It appears that when I omit the version
option from a docker-compose
file, docker-compose treats it as a version 1 file. Further, a version 1 file does not support using build
together with image
, so I'm now trying later versions and see what I can wrangle from the build.
The build failed with version: "3"
and succeeded with version:"2"
.
I see other projects using version: "2.1"
but for now we don't have any need for the extra capabilities that come with 2.1 so this seems good enough for now.
As of this commit and this Travis build log, I have visible confirmation that using the version: "2"
option correctly allows the container image to be built and published to ECR correctly.
Our project (https://github.com/hackoregon/team-budget) is using the [backend-service-pattern] code to try to deploy the container that Travis builds for us. We're using the
ecs-deploy.sh
script and the same build sequence (if modified to work in all local and Travis scenarios).Problem
I'm getting the following response when running
docker push "$DOCKER_REPO"/"$DEPLOY_TARGET"/"$DOCKER_IMAGE":latest
:Further back in the build sequence, the standard
docker-compose.yml
includes two instructions:However, when I enable the
image
section and its instruction,docker-compose
via TravisCI reports the following error:Research
When I read the Docker documentation for the image section, it contradictorily says, "If the image does not exist, Compose attempts to pull it, unless you have also specified build, in which case it builds it using the specified options and tags it with the specified tag."
That should mean that
build
andimage
can coexist, but the error message I'm receiving seems to indicate they cannot coexist.Hell, looking further at the [documentation for the build section](), it also reports, "If you specify image as well as build, then Compose names the built image with the webapp and optional tag specified in image:
So everything except my runtime experience tells me to include the image section. What am I missing?
Links
Working build (backend-service-pattern): https://travis-ci.org/hackoregon/backend-service-pattern/builds/212920258 My failing build (team-budget): https://travis-ci.org/hackoregon/team-budget/builds/213610942