[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[atomic] atomic run/LABEL RUN issue when exposing container ports to the host



Hi,

I am having issues with "atomic run" and also with LABEL RUN where the exposed ports in container are not being published to the host. I have following in Dockerfile:

LABEL RUN="docker run -d -p 4001:4001 -p 7001:7001 -p 2379:2379 -p 2380:2380  IMAGE"

Running the container:

#atomic run etcd
etcd
# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS                               NAMES
4804270b3b28        etcd                "/usr/bin/etcd"     About a minute ago   Up 4 seconds        2379-2380/tcp, 4001/tcp, 7001/tcp   etcd

In the above, the ports are not being published to the host. Not sure what is wrong here? am I missing something?

However when I try docker run, the same container works as expected:

#docker run -d -p 4001:4001 -p 7001:7001 -p 2379:2379 -p 2380:2380 etcd
754c29fcc2a0e2edb16981afbf4ba5b92a641099ab014a58bb7c213141cc07b6
Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.

# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                                                              NAMES
754c29fcc2a0        etcd                "/usr/bin/etcd"     20 seconds ago      Up 18 seconds       0.0.0.0:2379-2380->2379-2380/tcp, 0.0.0.0:4001->4001/tcp, 0.0.0.0:7001->7001/tcp   modest_feynman

Here the ports are published to the host correctly. 

I also tried another version of LABEL RUN with optional argument as follows:

LABEL RUN /usr/bin/docker run -d \$OPT1 --name \$NAME \$IMAGE \$OPT2 \$OPT3

#atomic run --opt1="-p 4001:4001 -p 7001:7001 -p 2379:2379 -p 2380:2380" etcd
etcd
#docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                               NAMES
b4f393cfbae4        etcd                "/usr/bin/etcd"     50 seconds ago      Up 7 seconds        2379-2380/tcp, 4001/tcp, 7001/tcp   etcd

But here again it does not work as expected as ports are being published to the host.

Any help is appreciated.

Thanks
Avesh

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]