Created
November 8, 2014 00:22
-
-
Save tomaslin/96bd8108688ea9308daa to your computer and use it in GitHub Desktop.
Docker calls via Spotify Docker client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grapes( | |
@Grab(group='com.spotify', module='docker-client', version='2.7.0') | |
) | |
import com.spotify.docker.client.messages.* | |
import com.spotify.docker.client.DefaultDockerClient | |
import com.spotify.docker.client.DockerClient | |
DockerClient docker = new DefaultDockerClient('myinstace') | |
def config = ContainerConfig.builder().image('busybox').cmd('env').build() | |
def creation = docker.createContainer(config) | |
println creation.id | |
String id = creation.id | |
docker.startContainer(id) | |
docker.waitContainer(id) | |
docker.killContainer(id) | |
println docker.logs(id, DockerClient.LogsParameter.STDOUT, DockerClient.LogsParameter.FOLLOW).readFully() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment