Skip to content

Commit c0e662e

Browse files
author
Matthew Fisher
committed
Merge pull request #3640 from bacongobbler/1156-expose-only-one-port-or-none
chore(controller): remove $PORT logic from fleet
2 parents 48c965d + e293667 commit c0e662e

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

controller/scheduler/fleet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def attach(self, name):
379379
{"section": "Unit", "name": "Description", "value": "{name}"},
380380
{"section": "Service", "name": "ExecStartPre", "value": '''/bin/sh -c "IMAGE=$(etcdctl get /deis/registry/host 2>&1):$(etcdctl get /deis/registry/port 2>&1)/{image}; docker pull $IMAGE"'''}, # noqa
381381
{"section": "Service", "name": "ExecStartPre", "value": '''/bin/sh -c "docker inspect {name} >/dev/null 2>&1 && docker rm -f {name} || true"'''}, # noqa
382-
{"section": "Service", "name": "ExecStart", "value": '''/bin/sh -c "IMAGE=$(etcdctl get /deis/registry/host 2>&1):$(etcdctl get /deis/registry/port 2>&1)/{image}; port=$(docker inspect -f '{{{{range $k, $v := .ContainerConfig.ExposedPorts }}}}{{{{$k}}}}{{{{end}}}}' $IMAGE | cut -d/ -f1) ; docker run --name {name} {memory} {cpu} {hostname} -P -e PORT=$port $IMAGE {command}"'''}, # noqa
382+
{"section": "Service", "name": "ExecStart", "value": '''/bin/sh -c "IMAGE=$(etcdctl get /deis/registry/host 2>&1):$(etcdctl get /deis/registry/port 2>&1)/{image}; docker run --name {name} {memory} {cpu} {hostname} -P $IMAGE {command}"'''}, # noqa
383383
{"section": "Service", "name": "ExecStop", "value": '''/usr/bin/docker stop {name}'''},
384384
{"section": "Service", "name": "ExecStop", "value": '''/usr/bin/docker rm -f {name}'''},
385385
{"section": "Service", "name": "TimeoutStartSec", "value": "20m"},

docs/using_deis/using-docker-images.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Docker Image Requirements
3131
In order to deploy Docker images, they must conform to the following requirements:
3232

3333
* The Docker image must EXPOSE only one port
34-
* The exposed port must be an HTTP service that can be connected to an HTTP router
34+
* The port must be listening for a HTTP connection
3535
* A default CMD must be specified for running the container
3636

3737
.. note::

docs/using_deis/using-dockerfiles.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Dockerfile Requirements
2222
In order to deploy Dockerfile applications, they must conform to the following requirements:
2323

2424
* The Dockerfile must EXPOSE only one port
25-
* The exposed port must be an HTTP service that can be connected to an HTTP router
25+
* The port must be listening for a HTTP connection
2626
* A default CMD must be specified for running the container
2727

2828
.. note::

publisher/server/publisher.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ func (s *Server) publishContainer(container *docker.APIContainers, ttl time.Dura
111111
keyPath := fmt.Sprintf("/deis/services/%s", appPath)
112112
dirPath := fmt.Sprintf("/deis/services/%s", appName)
113113
for _, p := range container.Ports {
114+
// lowest port wins (docker sorts the ports)
115+
// TODO (bacongobbler): support multiple exposed ports
114116
port := strconv.Itoa(int(p.PublicPort))
115117
hostAndPort := s.host + ":" + port
116118
if s.IsPublishableApp(containerName) && s.IsPortOpen(hostAndPort) {
@@ -120,7 +122,6 @@ func (s *Server) publishContainer(container *docker.APIContainers, ttl time.Dura
120122
safeMap.data[container.ID] = appPath
121123
safeMap.Unlock()
122124
}
123-
// TODO: support multiple exposed ports
124125
break
125126
}
126127
}

0 commit comments

Comments
 (0)