I'm using Spotify's Docker-Client, but have ran into a documentation wall. I'm trying to figure out how to pass docker secrets that are already created in the environment to the containers built using docker-client. The documentation only shows how to create secrets, but this isn't very useful since the secrets already exist. I'm able to get a list of secrets in the environment using the listSecrets in DockerClient, but I have no way to convert them from Secret to SecretBind. Any help is very much appreciated.
Asked
Active
Viewed 120 times
2
danmit88
- 23
- 1
- 4
1 Answers
0
I figured this out looking through all of the code spotify/docker-client code. The documentation does not show a way to convert a Secret to SecretBind that ContainerSpec needs to pass in the Docker Secrets.
public SecretBind createBind(Secret secret) {
SecretFile file = SecretFile.builder()
.name(secret.secretSpect().name())
.uid("0")
.gid("0")
.build();
SecretBind bind = SecretBind.builder()
.secretName(secret.secretSpec().name())
.secretId(secret.id())
.file(file)
.build();
return bind;
}
danmit88
- 23
- 1
- 4