Skip to content

Instantly share code, notes, and snippets.

@lucywyman
Created October 16, 2017 20:48
Show Gist options
  • Save lucywyman/770688907d8983df51cd5698d95e4d2a to your computer and use it in GitHub Desktop.
Save lucywyman/770688907d8983df51cd5698d95e4d2a to your computer and use it in GitHub Desktop.
Create containers task
{
"description": "POC for creating container in a task",
"parameters": {
"container_name": {
"description": "Optional name for the container",
"type": "Optional[ String ]"
},
"dockerfile_path": {
"description": "Path to Dockerfile",
"type": "Optional[ String ]"
},
"options": {
"description": "Optional list of options for docker command",
"type": "Optional[ String ]"
},
"docker_container": {
"description": "If running a container from dockerhub, the dockerhub container to run",
"type": "Optional[ String ]"
},
"command": {
"description": "The command to run if running -it",
"type": "Optional[ String ]"
}
}
}
#!/usr/bin/env bash
if [ -z "$PT_dockerfile_path"]; then
docker build -t $PT_container_name $PT_dockerfile_path
docker run $PT_options $PT_container_name $PT_command
docker ps
elif [ -z "$PT_docker_container"]; then
docker run $PT_options $PT_docker_container $PT_command
docker ps
else
echo "You need to provide a docker hub container to run or a Dockerfile!"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment