Skip to content

Commit 0255c84

Browse files
authored
docs(docker): example for ssh-key usage (#3569)
1 parent 8e9e487 commit 0255c84

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

docs/docker.md

+18-6
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,36 @@ The CLI can be used in Docker without any problem.
66

77
In order to use it you must mount the scaleway configuration file:
88
```sh
9-
docker run -it --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.3.0
9+
docker run -it --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.26.0
1010
```
1111

1212
If you want to use `scw` instead of `docker run` you can add the following in your `~/.bashrc`:
1313
```bash
1414
scw() {
15-
docker run -it --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.3.0 "$@"
15+
docker run -it --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.26.0 "$@"
1616
}
1717
export -f scw
1818
```
1919

2020
Or if you use ZSH, add the following in your `~/.zshrc`:
2121
```zsh
2222
scw() {
23-
docker run -it --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.3.0 $@
23+
docker run -it --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.26.0 $@
2424
}
2525
```
2626

27+
## Use your ssh-key
28+
29+
In order to use your ssh-key you must mount your .ssh folder
30+
```sh
31+
docker run -it --rm -v $HOME/.config/scw:/root/.config/scw -v $HOME/.ssh:/root/.ssh scaleway/cli:v2.26.0 $@
32+
```
33+
34+
You can then ensure that your ssh key is present in your Scaleway account
35+
```sh
36+
scw iam ssh-key init
37+
```
38+
2739
## Autocompletion
2840

2941
You can still use autocompletion while running the CLI in Docker, you just need to modify script generated by the CLI.
@@ -44,14 +56,14 @@ complete -F _scw scw
4456
And in your `~/.bashrc` you can add:
4557
```bash
4658
scw() {
47-
docker run -it --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.3.0 "$@"
59+
docker run -it --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.26.0 "$@"
4860
}
4961
export -f scw
5062

5163
_scw() {
5264
_get_comp_words_by_ref -n = cword words
5365

54-
output=$(docker run -i --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.3.0 autocomplete complete bash -- "$COMP_LINE" "$cword" "${words[@]}")
66+
output=$(docker run -i --rm -v $HOME/.config/scw:/root/.config/scw scaleway/cli:v2.26.0 autocomplete complete bash -- "$COMP_LINE" "$cword" "${words[@]}")
5567
COMPREPLY=($output)
5668
# apply compopt option and ignore failure for older bash versions
5769
[[ $COMPREPLY == *= ]] && compopt -o nospace 2> /dev/null || true
@@ -66,5 +78,5 @@ The trick is to remove the `-t` when using docker inside the completion function
6678
If running with Podman and SELinux in enforcing mode, one must use the :Z option when mounting the configuration file.
6779
For instance:
6880
```bash
69-
podman run -it --rm -v $HOME/.config/scw:/root/.config/scw:Z scaleway/cli:v2.3.0
81+
podman run -it --rm -v $HOME/.config/scw:/root/.config/scw:Z scaleway/cli:v2.26.0
7082
```

0 commit comments

Comments
 (0)