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 npipe volume type on stack file #1195

Merged
merged 1 commit into from
Sep 28, 2018

Conversation

olljanat
Copy link
Contributor

@olljanat olljanat commented Jul 8, 2018

- What I did
Added volume type npipe to compose file handing.

- How to verify it
Can be tested together with docked from moby/moby#37400

Pre-requirement for moby/moby#37400 to be able to fix moby/moby#34795

@silvin-lubecki
Copy link
Contributor

@simonferquel Could you take a look please?

Copy link
Contributor

@simonferquel simonferquel left a comment

Choose a reason for hiding this comment

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

Overall lgtm, just a single nitpicking on unknown mount types error message

@@ -135,6 +155,8 @@ func convertVolumeToMount(
return handleBindToMount(volume)
case "tmpfs":
return handleTmpfsToMount(volume)
case "npipe":
return handleNpipeToMount(volume)
}
return mount.Mount{}, errors.New("volume type must be volume, bind, or tmpfs")
Copy link
Contributor

Choose a reason for hiding this comment

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

Error message should now include npipe as a valid mount type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I included it to commit now.

@simonferquel
Copy link
Contributor

Did not have time to review the moby/moby and swarmkit prs though

@olljanat olljanat force-pushed the 34795-npipe-mount-type branch 2 times, most recently from de98345 to 8178403 Compare September 12, 2018 15:31
@olljanat
Copy link
Contributor Author

@simonferquel swarmkit PR was just merged so can we also merge this one so I will be able to get that moby/moby done?

@olljanat
Copy link
Contributor Author

@vdemeester can you please look this one too?

After moby/moby#37400 is merged we will be able to use named pipes with docker service create but this one is needed to be able do same thing with stack.

@simonferquel
Copy link
Contributor

I think we should merge the moby side first

@olljanat
Copy link
Contributor Author

@simonferquel @vdemeester @thaJeztah moby/moby#37400 have been merged so can we merge this one too?

Copy link
Collaborator

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐯

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

Thanks! Overall looking good, but I think some more changes are needed 😅 🤗. I'll make a summary

@thaJeztah
Copy link
Member

Thanks @olljanat! Looks like some changes are needed to the compose-file schema. Given that this is a new option, and the 3.7 schema is now frozen, that would involve a new schema version (3.8), and changes to this section; https://github.com/docker/cli/blob/master/cli/compose/schema/data/config_schema_v3.7.json#L279-L317

Also ping @shin- for changes in docker compose 🤗

The compose-file reference in the documentation repository will also need a slight update; https://github.com/docker/docker.github.io/blob/master/compose/compose-file/index.md#long-syntax-3, and mention the new option (that's in the documentation repository, so will be a follow up, or separate PR)

Some changes to the reference documentation are needed; the reference docs for docker service create; this section mentions the available types for --mount, so needs some information about the new type; https://github.com/docker/cli/blob/master/docs/reference/commandline/service_create.md#add-bind-mounts-volumes-or-memory-filesystems

Finally, we'll probably need some changes to the "storage" documentation for the new type; https://github.com/docker/docker.github.io/blob/master/storage/index.md That's also in the documentation repository, so can be done as a follow-up.

Perhaps we need some assistance from the documentation team for that (we can make a tracking issue if needed)

@shin-
Copy link
Contributor

shin- commented Sep 26, 2018

@thaJeztah It's already supported in docker-compose since 1.18.0 👼 docker/compose#5181

Also AFAICT, this doesn't require any changes to the schema; since we don't do any validation on the mount type field, this will work retroactively with any schema that supports the mount syntax (so 3.2+).

@olljanat
Copy link
Contributor Author

@thaJeztah I added one commit which contains service create documentation and created PR docker/docs/pull/7427 of these two other page updates.

Also please note that named pipes support have been originally added for non-swarm mode over year ago on moby/moby/pull/33852 so maybe you can also ask help from these Microsoft dudes if more detailed documentation of named pipes are needed.

@thaJeztah
Copy link
Member

Also AFAICT, this doesn't require any changes to the schema; since we don't do any validation on the mount type field, this will work retroactively with any schema that supports the mount syntax (so 3.2+).

@shin- @olljanat doh! You're right; I got confused there; the section I was pointing to is for the tmpfs, volume, and bind options to be passed as part of a volume, i.e.;

volumes:
  - type: tmpfs
    tmpfs:
      size: 12345

my bad! 😊

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

Thanks for updating! Found some small issues in the documentation changes; could you also squash both commits? It's ok to have docs and code changes in the same commit for this PR.

<ul>
<li><tt>volume</tt>: mounts a <a href="https://docs.docker.com/engine/reference/commandline/volume_create/">managed volume</a>
into the container.</li> <li><tt>bind</tt>:
bind-mounts a directory or file from the host into the container.</li>
<li><tt>tmpfs</tt>: mount a tmpfs in the container</li>
<li><tt>npipe</tt>: mounts named pide from the host into the container.</li>
Copy link
Member

Choose a reason for hiding this comment

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

😅 looks like you indented with a tab, instead of spaces here.

Also there's a typo; pide instead of pipe ☺️

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps it's good to add (Windows containers only) to the description

@@ -312,15 +314,16 @@ volumes in a service:
<th>Description</th>
</tr>
<tr>
<td><b>types</b></td>
<td><b>type</b></td>
Copy link
Member

Choose a reason for hiding this comment

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

👍 nice catch

<ul>
<li><tt>volume</tt>: mounts a <a href="https://docs.docker.com/engine/reference/commandline/volume_create/">managed volume</a>
into the container.</li> <li><tt>bind</tt>:
bind-mounts a directory or file from the host into the container.</li>
<li><tt>tmpfs</tt>: mount a tmpfs in the container</li>
<li><tt>npipe</tt>: mounts named pide from the host into the container.</li>
</ul></p>
</td>
</tr>
Copy link
Member

Choose a reason for hiding this comment

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

Could you also update the required column at line 332 below https://github.com/docker/cli/pull/1195/files#diff-d4779426535b6679e406cf721c9f9289R332 ?

It currently says;

<td>for <tt>type=bind</tt> only></td>

Which should now be;

<td>for <tt>type=bind</tt> and <tt>type=npipe</tt></td>

(Noticed there's a stray > there as well)

@@ -291,6 +291,8 @@ You can back up or restore volumes using Docker commands.

A **tmpfs** mounts a tmpfs inside a container for volatile data.

A **npipe** mounts a named pide from the host into the container.
Copy link
Member

Choose a reason for hiding this comment

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

whoops typo: pide (should be pipe)

Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
@olljanat olljanat force-pushed the 34795-npipe-mount-type branch from f50136a to 0704d9a Compare September 27, 2018 15:47
@olljanat
Copy link
Contributor Author

@thaJeztah requested changes should be in-place now.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!!

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.

Windows: Support named pipe mounts in docker service create + stack yml
8 participants