Skip to content

Add support of ssh authentications defined in compose file or via cli…#9325

Merged
ndeloof merged 2 commits intodocker:v2from
glours:add-ssh-build
Mar 31, 2022
Merged

Add support of ssh authentications defined in compose file or via cli…#9325
ndeloof merged 2 commits intodocker:v2from
glours:add-ssh-build

Conversation

@glours
Copy link
Copy Markdown
Contributor

@glours glours commented Mar 30, 2022

… flags

What I did

  • Add support of an ssh flag for the build command
  • Generate an SSH Agent Provider from both cli flag and Compose file configuration

Related issue
fix #7025

(not mandatory) A picture of a cute animal, if possible in relation with what you did
image

@glours glours self-assigned this Mar 30, 2022
@glours glours force-pushed the add-ssh-build branch 3 times, most recently from 413232b to 488dd40 Compare March 30, 2022 13:46
@glours glours force-pushed the add-ssh-build branch 5 times, most recently from acad762 to 3faf92c Compare March 31, 2022 08:54
@glours glours marked this pull request as ready for review March 31, 2022 09:53
@glours glours requested a review from ulyssessouza March 31, 2022 10:03
@ndeloof
Copy link
Copy Markdown
Contributor

ndeloof commented Mar 31, 2022

🎉

@ndeloof ndeloof merged commit 934b596 into docker:v2 Mar 31, 2022
@levrik
Copy link
Copy Markdown

levrik commented Mar 31, 2022

Is there any expected timeline when this will hit Docker on Linux and macOS?

@aleksandrs-ledovskis
Copy link
Copy Markdown

It's possible to already use it on macOS and Linux if compiled from repo's source.

For those using Homebrew, the command is $ brew install --head docker-compose.

| `--progress` | `string` | `auto` | Set type of progress output (auto, tty, plain, quiet) |
| `--pull` | | | Always attempt to pull a newer version of the image. |
| `-q`, `--quiet` | | | Don't print anything to STDOUT |
| `--ssh` | `string` | | Set SSH authentications used when building service images. (use 'default' for using you default SSH Agent) |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

s/using you/using your/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hivemind with #9334 🙂

@nleroy917
Copy link
Copy Markdown

Hello,

I compiled from source (brew install --head docker-compose), but the --ssh flag still seems unknown:

docker-compose up --build --ssh default 
unknown flag: --ssh

Version seems up to date:

docker-compose -v                      
Docker Compose version HEAD-7969667

Any help would be appreciated!

@glours
Copy link
Copy Markdown
Contributor Author

glours commented Jul 6, 2022

@nleroy917 --ssh flag can be use with docker compose build but is not available with docker compose up command

@nleroy917
Copy link
Copy Markdown

🤦🏻‍♂️ That makes sense. Thank you!

@glours glours deleted the add-ssh-build branch January 11, 2023 14:57
@IT-Ideas
Copy link
Copy Markdown

Hello all!
If I am not mistaken this only take one pair key/value as argument of --ssh, right?
We are in a situation where we would have like to pass two different ssh keys.
Would there be any plans to manage this use case?

Thanks!

@ndeloof
Copy link
Copy Markdown
Contributor

ndeloof commented Dec 13, 2023

@IT-Ideas ssh configuration should be set by your compose.yaml file inside the build section (https://docs.docker.com/compose/compose-file/build/#ssh). --ssh flag is just a helper for simplest use-cases, imho we should not expose such flags which are redundant with the yaml model

@IT-Ideas
Copy link
Copy Markdown

Hi @ndeloof,
I agree with you and I actually tested it, but the path to the key was then not working although it worked when passing it through the command.
The path beeing ~/.ssh/keyname.

Thanks 🙂

@IT-Ideas
Copy link
Copy Markdown

@ndeloof Maybe I did a mistake, I'll have one more try!

@ndeloof
Copy link
Copy Markdown
Contributor

ndeloof commented Dec 13, 2023

please open a dedicated issue if you can reproduce this error and attach a sample compose.yaml file, thanks

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.

Enable ssh option as build parameter for buildkit

6 participants