Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build image if "--build" is passed, alternatively pull image from registry #6086

Closed
chrispader opened this issue Jul 17, 2018 · 5 comments
Closed
Labels

Comments

@chrispader
Copy link

chrispader commented Jul 17, 2018

Feature Request: Build image if --build is passed, alternatively pull image from registry

I don't know if this is working yet, but it would be a great feature, if you could toggle between building a image and pulling it from the registry.

So what i mean is that if you provide the --build parameter, docker compose should build the image from a Dockerfile, and if no --build is passed, the registry image (image: registry.docker.com/bla) will be used.

So for example i would use this docker-compose.yml file:

version: '3.0'
services:
  devserver:
    image: registry.docker.com/superspecialdevserver
    build: docker/devserver
    restart: always
    container_name: devserver

And the Dockerfile would be sitting in docker/devserver

Output of "docker-compose version"

docker-compose version 1.20.1, build 5d8c71b2
docker-py version: 3.1.4
CPython version: 3.6.4
OpenSSL version: OpenSSL 1.0.2k  26 Jan 2017

Output of "docker version"

Client:
 Version:       18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24302
 Built: Fri Mar 23 08:31:36 2018
 OS/Arch:       windows/amd64
 Experimental:  false
 Orchestrator:  swarm

Server:
 Engine:
  Version:      18.05.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.10.1
  Git commit:   f150324
  Built:        Wed May  9 22:20:42 2018
  OS/Arch:      linux/amd64
  Experimental: false
@chrispader chrispader changed the title Feature Request: Build image if --build is set, alternatively pull image from registry Build image if --build is set, alternatively pull image from registry Jul 17, 2018
@chrispader chrispader changed the title Build image if --build is set, alternatively pull image from registry Build image if "--build" is set, alternatively pull image from registry Jul 17, 2018
@chrispader chrispader changed the title Build image if "--build" is set, alternatively pull image from registry Build image if "--build" is passed, alternatively pull image from registry Jul 17, 2018
@gbraad
Copy link

gbraad commented Jul 22, 2018

What you propose changes existing behaviour, right?

If you use

build: ./dir
image: webapp:tag

It instructs to build from the specified ./dir, and tag the image as image: webapp:tag Ref. Your proposed solution would in that case ignore the build and pull the image instead, UNLESS the option --build is given? This would break current expectation and implementations.

@chrispader
Copy link
Author

Maybe there is an alternative way of implementing this feature. So that you can choose between pulling and building the image. Maybe over an extra option?

Something like:

build: ./dir
image: webapp:tag
pullImage: registry.docker.com/webapp:latest

And then you could run something like docker-compose up -d --pull?

@zerkz
Copy link

zerkz commented Sep 12, 2018

Don't believe this is up for being implemented.

See this related issue: #3574

@stale
Copy link

stale bot commented Oct 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 9, 2019
@stale
Copy link

stale bot commented Oct 16, 2019

This issue has been automatically closed because it had not recent activity during the stale period.

@stale stale bot closed this as completed Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants