atomic breaks port mappings for non SPCs #129
Comments
@aveshagarwal That makes no sense. You are not running the container in --spc mode which is the only thing hard coded to run --net=host. When you run the atomic run etcd command what does the atomic tool say it is executing? Please attach your dockerfile and I will try it here. |
@rhatdan what does not make sense? Yes I am not running with --spc mode. |
@rhatdan any feedback about what might be wrong with the dockerfile or something else? |
@aveshagarwal when you execute |
@aveshagarwal I am back from PTO and business trips. Your Dockerfile looks fine. What command are you executing to install your image? |
on rhel7.2beta: [root@kube-master etcd-container]#atomic install etcd On atomic 7.1.4: |
@aveshagarwal They look like they are using two different images at least from the point of view of the labels being executed. But is there a bug above that I am missing? |
@rhatdan they are using exactly same image on rhel7.2 beta: atomic version on 7.2beta: On atomic 7.1.4: atomic version on atomic 7.1.4 Is it possible that the difference in labels being executed might be due to difference versions of atomic on 7.2beta and atomic 7.1.4? |
atomic info IMAGE On both images. Maybe you have a different version of the atomic tool? |
Right, I provided their version numbers in the previous comment. On 7.2.beta: on atomic 7.1.4: |
You never showed the output of -bash-4.2# docker ps -a On beta release version. |
7.2beta: [root@kube-master ~]# docker ps -a |
And the expected results should look like? |
Right |
if you run the same image directly with docker run, port mapping works correctly on both rhel and atomic. |
It looks like the $OPT are causing problems. I am attempting to build your image locally |
@rhatdan unless something changed recently I had tried without OPT args and the result was same. This problem I have seen even before OPT came into existence as far as I remember. |
https://lists.projectatomic.io/projectatomic-archives/atomic/2015-August/msg00000.html shows I had the same issue without OPT too. |
Do you have the root directory? |
Yes on both 7.2beta and atomic 7.1.4, why would you ask that? |
I need one to build my version. |
I got to run out now, I will look at this in the morning. |
No problem: git clone https://github.com/aveshagarwal/etcd-container |
The problem is that you are creating the container within the install without actually setting up the port mappings. In your install.sh you should be doing the following:
atomic run -n etcd etcd Will start the etcd container if it exists. If it does not exists it uses the run label. Since you were creating the container during install, if you do atomic install before atomic run, the run will only start the container if it is stopped. |
@rhatdan thanks, I tested it and it worked. I think i thought that normal flow was always Also my understanding was that Also If it is part of expected workflow that I think I am ok if this issue can be closed now. |
So after the initial run, the container gets created and all future runs become When people try to do single run containers, it gets confusing. I am not sure how we fix this problem atomic install is just in charge of setting up the container to run, it could use the atomic run command within its install, IE have the systemd unit files execute atomic run, or it could just do docker directly or k8s or run containers via the docker daemon to auto restart. Really want ultimate flexibility here.
|
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.
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 not are being published to the host correctly.
The text was updated successfully, but these errors were encountered: