Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Adds links support for the target container.
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbollen committed Apr 9, 2015
1 parent 196fa2e commit 20b9366
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ ENV IMAGE ubuntu
ENV CONTAINER_NAME ubuntu-test
#ENV CMD sleep 500


#ENV USERNAME you
#ENV PASSWORD secret

#ENV LINKS "your-db:db something-redis:redis"
ENV PASS_ENV PASS_ENV


EXPOSE 8080
WORKDIR /gopath/src/app
ADD . /gopath/src/app/

Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ docker run -P -v /var/run/docker.sock:/var/run/docker.sock -e ENDPOINT=/secret -

The go script uses these environment variables as config:

| ENV | Required | Default | Description |
| -------------- |--------- |---------------------------- |------------------------------------------------------------------------------------------ |
| PASSWORD | true | | Your dockerhub username when pulling an image |
| USERNAME | true | | Your dockerhub password when pulling an image |
| DOCKERSOCKET | true | unix:///var/run/docker.sock | The URI used to connect to the Docker host |
| ENDPOINT | true | / | The __secret__ endpoint that triggers the deploy (CHANGE THIS!) |
| IMAGE | true | ubuntu | The image name to pull and re-create |
| CONTAINER_NAME | true | ubuntu-test | The name of the instance container to kill and start again |
| CMD | false | | The command to run inside the deployed container, can be empty |
| PASS_ENV | false | PASS_ENV | A space seperated list of environment variables to pass on to the newly created container |
| ENV | Default | Description |
| -------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
| PASSWORD | | Your dockerhub username when pulling an image |
| USERNAME | | Your dockerhub password when pulling an image |
| DOCKERSOCKET | unix:///var/run/docker.sock | The URI used to connect to the Docker host |
| ENDPOINT | / | The __secret__ endpoint that triggers the deploy (CHANGE THIS!) |
| IMAGE | ubuntu | The image name to pull and re-create |
| CONTAINER_NAME | ubuntu-test | The name of the instance container to kill and start again |
| CMD | | The command to run inside the deployed container, can be empty |
| PASS_ENV | PASS_ENV | A space seperated list of environment variables to pass on to the newly created container |
| LINKS | | Links for the docker container, format is "container:alias" seperated by space |
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ func main() {
}
create := docker.CreateContainerOptions{Name: containerName, Config: &config}
hostConfig := docker.HostConfig{PublishAllPorts: true}

links := os.Getenv("LINKS")
if len(links) != 0 {
hostConfig.Links = strings.Split(links, " ")
}

deploy := make(chan int, 100)

go func() {
Expand Down

0 comments on commit 20b9366

Please sign in to comment.