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

Allow Local Images for Docker Storage #1052

Merged
merged 3 commits into from May 20, 2019
Merged

Allow Local Images for Docker Storage #1052

merged 3 commits into from May 20, 2019

Conversation

joshmeek
Copy link

@joshmeek joshmeek commented May 20, 2019

Thanks for contributing to Prefect!

Please describe your work and make sure your PR:

  • adds new tests (if appropriate)
  • updates CHANGELOG.md (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

Note that your PR will not be reviewed unless all three boxes are checked.

What does this PR change?

Closes #722

Why is this PR important?

Sometimes users want to build custom base images before adding their flows. This allows for it by skipping the pull step if user specifies local_image=True

@joshmeek joshmeek added the enhancement An improvement of an existing feature label May 20, 2019
@joshmeek
Copy link
Author

joshmeek commented May 20, 2019

Also, did verify locally that this works (truncated for ease of reading):

# Building local image
from io import BytesIO

from docker import APIClient

dockerfile = '''
# Shared Volume
FROM python:3.6
RUN ls
'''

f = BytesIO(dockerfile.encode('utf-8'))

cli = APIClient(base_url='unix://var/run/docker.sock')

response = [line for line in cli.build(
    fileobj=f, rm=True, tag='mytest/local'
)]
# Using local image in Docker storage
from prefect import Flow
from prefect.environments.storage import Docker

st = Docker(registry_url=...", base_image="mytest/local:latest", local_image=True)

f = Flow("my_local_test", storage=st)

f.deploy(project_name="...")
# Output from deployment showing it was used
Step 1/9 : FROM mytest/local:latest
 ---> 06ddeb338f8d
...

@codecov
Copy link

codecov bot commented May 20, 2019

Codecov Report

Merging #1052 into master will increase coverage by <.01%.
The diff coverage is 100%.

Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa this is so much simpler than I imagined it would be - awesome!!

@joshmeek joshmeek merged commit 9cbdde0 into master May 20, 2019
@joshmeek joshmeek deleted the local_images branch May 20, 2019 15:05
abrookins pushed a commit that referenced this pull request Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Local docker images should be available as base images for environments
2 participants