这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@nickl-
Copy link

@nickl- nickl- commented Mar 31, 2014

purpose

Consistency between running containers for build and deploy and possibly other scenarios in the future.

problem

We need consistency between the docker run for build and docker run for deploy, but in future other scenarios may also present itself. With the addition of dokku-args we can now mount volumes, for example, but this is currently only implemented for deploy which is problematic for the build process which is now unaware of these volumes.

Another inconsistency which already revealed itself as well, as pointed out by #511, is the absence of a CONTAINER lookup which is only created at deploy and never populated when a build fails or is terminated.

proposal

To avoid duplication and improve reusability a function wrapping the common functionality can be employed, as this merge request would suggest. To reduce cognitive friction in implementation, a compatibility with the original docker implemented call signature was sought hence the function name docker_run.

 $ docker_run [[call arguments] [..]] <docker image> <command> [[command arguments] [...]]

The method will dynamically parse arguments to deduce that everything before the global variable $IMAGE is considered call arguments and everything post this reference will be part and purpose of the command. This allows executing of the function docker_run in exactly the same familiar fashion as we would otherwise call docker run for this purpose with no concern for dokku-args, which gets injected before the image, or any future evolutions of the way a container is run.

This was also the most logical instance at which to log the container id while effectively obfuscating the complexities/requirement from the caller which continues to receive the output as it normally would.

possibilities

Currently only applicable to and implemented for build and deploy but may in future apply to other scenarios as well.

Another consideration would be to enhance the hook api and to separate the arguments passable to build and deploy etc. which should not obstruct this merge request nor be reason to complicate the calling signature as is proposed.

Due to the fixed nature of the process flow identifying which process is calling can be facilitated by a simple counter persisted externally or based on other artifacts created in the $APP location. We could choose to simply pass this identifier along to a new dokku-args hook specification or create separate hooks for each all without additional requirements to the caller.

We need consistency between the docker run for build and docker run for deploy, in future other scenarios may also present itself.
With the addition of dokku-args we can now mount volumes, for example, but this is currently only implemented for deploy which is problematic for the build process.
This also now easily accommodates a fix for dokku#511 by ensuring that the CONTAINER lookup is populated consistently.

To reduce cognitive friction compatibility with the original docker implementation call signature was sought hence the function name docker_run.
Everything before the global  is considered call arguments and everything post this reference will form part of the command.
This allows executing of the function docker_run in exactly the same way as we would otherwise call docker run for this purpose with no concern for dokku-args, which gets injected before the  or any future evolutions of the way a container is run. This was also the most logical instance at which to log the container id which is dependent on by others while effectively obfuscating the complexities/requirements from the caller.
Currently only applicable to and implemented for build and deploy but may in future apply to other scenarios as well.
@josegonzalez
Copy link
Member

I know it's been a while, but can you walk me through exactly what your PR is doing?

@josegonzalez
Copy link
Member

@michaelshobbs I looked this over, and it seems reasonable. Any reason we wouldn't want to add docker-args to the build step?

@michaelshobbs
Copy link
Member

I can't think of a good reason. Let's do it. I can PR it if you'd like.

@josegonzalez
Copy link
Member

Go ahead and PR it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants