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

Pull image by default, if not build #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ivan1993br
Copy link
Contributor

Description

  1. Pull the image by default
    • Today, even if you not specify the option --build, if not existent the image will be built by default. The idea is to pull instead of build

Related Issues:

Copy link
Collaborator

@mateus-amarante mateus-amarante left a comment

Choose a reason for hiding this comment

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

I didn't pay attention to this behavior before. Nice catch! The update is simple and seems correct! I only have some questions.

The docs are a bit confusing to me. From the compose-spec:

image
If the image does not exist on the platform, Compose implementations MUST attempt to pull it based on the pull_policy. Compose implementations with build support MAY offer alternative options for the end user to control precedence of pull over building the image from source, however pulling the image MUST be the default behavior.

It sounds there is a way to "control the precedence of pull over building", but it is not clear how to do that. Did you try to tweak the yaml file (maybe pull_policy)?

@@ -50,7 +50,11 @@ fi
ROS_DISTRO=$ROS_DISTRO \
VOLUMES_FOLDER=$VOLUMES_FOLDER \
CONTAINER_NAME=$CONTAINER_NAME \
docker-compose -p "$ROS_DISTRO" --env-file .env up $BUILD_IMAGE_OPT -d devel
docker-compose -p "$ROS_DISTRO" --env-file .env $BUILD_IMAGE_OPT devel
Copy link
Collaborator

@mateus-amarante mateus-amarante Feb 21, 2021

Choose a reason for hiding this comment

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

How does it behave on calling it for the second time?

Comment on lines +53 to +57
docker-compose -p "$ROS_DISTRO" --env-file .env $BUILD_IMAGE_OPT devel
ROS_DISTRO=$ROS_DISTRO \
VOLUMES_FOLDER=$VOLUMES_FOLDER \
CONTAINER_NAME=$CONTAINER_NAME \
docker-compose -p "$ROS_DISTRO" --env-file .env up -d devel
Copy link
Collaborator

Choose a reason for hiding this comment

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

I just want to ask you to check if you have problems running two containers of different distros simultaneously (the -p option is intended to solve this, but I don't know how it behaves by setting it on separate build/pull and up steps)

@ivan1993br
Copy link
Contributor Author

It sounds there is a way to "control the precedence of pull over building", but it is not clear how to do that. Did you try to tweak the yaml file (maybe pull_policy)?

No, you are right, this should be the right place to fix it, I will look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker compose prefers to build instead of pull the orise image, even without --build option
2 participants