Launching an app from dockerfile fails
Hi, I'm trying the dockerfile workflow, and after pushing the image to private registry, I got:
Successfully built d05cf44a1ff9 -----> Pushing image to private registry
-----> Launching... ! ERROR: Failed to launch container ! {"detail": "JSON parse error - Invalid \escape: line 1 column 272 (char 271)"} To ssh://[email protected]:2222/docker-example.git 1ecfa03..8e67edd master -> master
Any ideas? How should I troubleshoot this issue? I'm running Deis 0.13.0 on vagrant.
@adrianmoya can you try the following?
$ fleetctl ssh deis-controller@1 docker logs deis-controller
Thanks!
These are the last lines from the log, let me know if it shows the info you need:
10.1.42.1 "GET /api/apps/docker-example/builds HTTP/1.0" 200 - "python-requests/2.3.0 CPython/2.7.6 Linux/3.13.0-37-generic"
10.1.42.1 "POST /api/hooks/push HTTP/1.1" 201 - "curl/7.35.0"
10.1.42.1 "POST /api/hooks/config HTTP/1.1" 200 - "curl/7.35.0"
10.1.42.1 "POST /api/hooks/push HTTP/1.1" 201 - "curl/7.35.0"
10.1.42.1 "POST /api/hooks/config HTTP/1.1" 200 - "curl/7.35.0"
10.1.42.1 "POST /api/hooks/build HTTP/1.1" 400 - "curl/7.35.0"
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
2014-10-16T05:05:51Z 0ed4fa7f30cd confd[1108]: ERROR Config check failed: exit status 1
2014-10-16T05:05:56Z 0ed4fa7f30cd confd[1108]: ERROR Config check failed: exit status 1
10.1.42.1 "POST /api/hooks/push HTTP/1.1" 201 - "curl/7.35.0"
10.1.42.1 "POST /api/hooks/config HTTP/1.1" 200 - "curl/7.35.0"
10.1.42.1 "POST /api/hooks/build HTTP/1.1" 400 - "curl/7.35.0"
Looks like etcd is flapping on that node, which may explain why confd started sputtering out errors as well. Can you please check its status for me?
$ fleetctl ssh deis-controller@1 journalctl -u --no-pager etcd
I got an error with your command, but this worked and it seems etcd is ok:
fleetctl ssh deis-controller@1 systemctl status etcd.service
● etcd.service - etcd
Loaded: loaded (/usr/lib64/systemd/system/etcd.service; static)
Drop-In: /run/systemd/system/etcd.service.d
└─20-cloudinit.conf
Active: active (running) since Tue 2014-10-14 23:42:25 UTC; 2 days ago
Main PID: 998 (etcd)
CGroup: /system.slice/etcd.service
└─998 /usr/bin/etcd
Oct 16 05:05:46 deis-1 etcd[998]: [etcd] Oct 16 05:05:46.284 INFO | c2f54a0694594ee8990137bbbb73d9f0: state changed from 'candidate' to 'follower'.
Oct 16 05:05:46 deis-1 etcd[998]: [etcd] Oct 16 05:05:46.284 INFO | c2f54a0694594ee8990137bbbb73d9f0: term #18 started.
Oct 16 05:10:31 deis-1 etcd[998]: [etcd] Oct 16 05:10:31.938 INFO | c2f54a0694594ee8990137bbbb73d9f0: snapshot of 10025 events at index 370656 completed
Oct 16 05:27:26 deis-1 etcd[998]: [etcd] Oct 16 05:27:26.196 INFO | c2f54a0694594ee8990137bbbb73d9f0: snapshot of 10019 events at index 380675 completed
Oct 16 05:44:20 deis-1 etcd[998]: [etcd] Oct 16 05:44:20.486 INFO | c2f54a0694594ee8990137bbbb73d9f0: snapshot of 10013 events at index 390688 completed
Oct 16 06:01:17 deis-1 etcd[998]: [etcd] Oct 16 06:01:17.740 INFO | c2f54a0694594ee8990137bbbb73d9f0: snapshot of 10007 events at index 400695 completed
Oct 17 02:57:01 deis-1 etcd[998]: [etcd] Oct 17 02:57:01.530 INFO | c2f54a0694594ee8990137bbbb73d9f0: warning: heartbeat near election timeout: 20h45m42.197734365s
Oct 17 03:04:02 deis-1 etcd[998]: [etcd] Oct 17 03:04:02.756 INFO | c2f54a0694594ee8990137bbbb73d9f0: snapshot of 10017 events at index 410712 completed
Oct 17 03:22:03 deis-1 etcd[998]: [etcd] Oct 17 03:22:03.394 INFO | c2f54a0694594ee8990137bbbb73d9f0: snapshot of 10049 events at index 420761 completed
Oct 17 03:38:57 deis-1 etcd[998]: [etcd] Oct 17 03:38:57.594 INFO | c2f54a0694594ee8990137bbbb73d9f0: snapshot of 10018 events at index 430779 completed
Maybe an effect of vagrant suspend/vagrant up the next day?
I destroyed and restared a fresh installation of Deis, and tried again. I got the same error. This is the controller's log:
INFO docker-example: config docker-example-c7c877a updated
INFO docker-example: build docker-example-4dd7129 created
INFO docker-example: release docker-example-v1 created
172.17.8.101 "POST /api/apps HTTP/1.0" 201 - "python-requests/2.3.0 CPython/2.7.6 Linux/3.13.0-37-generic"
172.17.8.100 "POST /api/hooks/push HTTP/1.1" 201 - "curl/7.35.0"
172.17.8.100 "POST /api/hooks/config HTTP/1.1" 200 - "curl/7.35.0"
172.17.8.100 "POST /api/hooks/build HTTP/1.1" 400 - "curl/7.35.0"
etcd logs shows no errors. This is my Dockerfile:
FROM dockerfile/java:oracle-java8
MAINTAINER Adrian Moya
ENV WILDFLY_VERSION 8.1.0.Final
RUN \
groupadd -r wildfly -g 433 && \
useradd -u 431 -r -g wildfly -d /opt/wildfly -s /sbin/nologin -c "WildFly user" wildfly && \
mkdir /opt/wildfly-$WILDFLY_VERSION && \
apt-get -y install curl && \
cd /opt && \
curl http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz | tar zx && \
chown -R wildfly:wildfly /opt/wildfly-$WILDFLY_VERSION && \
ln -s /opt/wildfly-$WILDFLY_VERSION /opt/wildfly && \
chown -R wildfly:wildfly /opt/wildfly
ENV JBOSS_HOME /opt/wildfly
EXPOSE 8080
ADD . /tmp/src/
WORKDIR /tmp/src/
RUN ["./gradlew", "build"]
RUN ["cp", "build/libs/docker-example.war", "/opt/wildfly/standalone/deployments/"]
USER wildfly
CMD ["/opt/wildfly/bin/standalone.sh", "-b", "0.0.0.0"]
Anything else I can check?
Could you check fleet as well? What version of CoreOS are you on?
I'm on CoreOS 459.0.0. Fleet/Etcd are working ok.
leet.service - fleet daemon Loaded: loaded (/usr/lib64/systemd/system/fleet.service; static) Drop-In: /run/systemd/system/fleet.service.d └─20-cloudinit.conf Active: active (running) since Sun 2014-10-19 02:26:14 UTC; 1h 58min ago Main PID: 947 (fleetd) CGroup: /system.slice/fleet.service └─947 /usr/bin/fleetd
Is there a way I can run a modified version of the controller? I'm not into python but I'd looked at the code where it fails and would like to print some info to the console to see if I can help fixing this.
I'm getting almost the same error building a Dockerfile on our newly installed Deis 0.13.1 cluster (3 node CoreOS 444.5.0). This worked prior to the re-install (running 0.12 previously).
Removing intermediate container 0688a37f48bf Step 6 : ENV GIT_SHA 2df9b434f7990136d40a2ede6f96b496ad4473f0 ---> Running in bdae198285b1 ---> 685c1ca2072f Removing intermediate container bdae198285b1 Successfully built 685c1ca2072f -----> Pushing image to private registry
-----> Launching... ! ERROR: Failed to launch container ! {"detail": "JSON parse error - Invalid \escape: line 1 column 423 (char 422)"} To ssh://[email protected]:2222/deploy.git
- [new branch] HEAD -> master
With no obvious errors on the controller:
Oct 19 07:42:31 vwi-coreos1 sh[10567]: INFO deploy: config deploy-e95c17f updated Oct 19 07:42:31 vwi-coreos1 sh[10567]: INFO deploy: build deploy-1a4597b created Oct 19 07:42:31 vwi-coreos1 sh[10567]: INFO deploy: release deploy-v1 created Oct 19 07:42:31 vwi-coreos1 sh[10567]: 10.1.2.23 "POST /api/apps HTTP/1.0" 201 - "python-requests/2.3.0 CPython/2.7.5 Darwin/14.0.0" Oct 19 07:42:41 vwi-coreos1 sh[10567]: 10.1.2.23 "POST /api/hooks/push HTTP/1.1" 201 - "curl/7.35.0" Oct 19 07:42:42 vwi-coreos1 sh[10567]: 10.1.2.23 "POST /api/hooks/config HTTP/1.1" 200 - "curl/7.35.0" Oct 19 07:43:55 vwi-coreos1 sh[10567]: 10.1.2.23 "POST /api/hooks/build HTTP/1.1" 400 - "curl/7.35.0"
I did some additional investigation, and it appears this issue may be caused by line continuation present in many Dockerfiles.
I managed to repeat the bug using https://github.com/deis/helloworld as an example.
A standard build of the project produces the expected running container:
Removing intermediate container c76d9f83e311
Step 10 : ENTRYPOINT ["/go/bin/helloworld"]
---> Running in 4d8055eb5b13
---> 5eec8712b609
Removing intermediate container 4d8055eb5b13
Step 11 : ENV GIT_SHA 1d735a097a1e46192a69bb023473149d92bd6d9a
---> Running in 719aada4f297
---> 55790a1f550c
Removing intermediate container 719aada4f297
Successfully built 55790a1f550c
-----> Pushing image to private registry
-----> Launching...
done, dockerfile-singleline:v2 deployed to Deis
http://dockerfile-singleline.viawest.sendoutcards.com
To learn more, use `deis help` or visit http://deis.io
To ssh://[email protected]:2222/dockerfile-singleline.git
* [new branch] master -> master
However, changing the Dockerfile to put the "RUN" statement on two lines as in the case of @adrianmoya yields the bug:
--- helloworld/Dockerfile 2014-10-19 09:22:14.000000000 -0600
+++ dockerfile-singleline/Dockerfile 2014-10-19 09:39:36.000000000 -0600
@@ -2,7 +2,8 @@
MAINTAINER OpDemand <[email protected]>
# install curl
-RUN apt-get update && apt-get install -qy curl
+RUN apt-get update && \
+ apt-get install -qy curl
# install go runtime
RUN curl -s https://storage.googleapis.com/golang/go1.2.2.linux-amd64.tar.gz | tar -C /usr/local -xz
Removing intermediate container eaed569f9c35
Step 10 : ENTRYPOINT ["/go/bin/helloworld"]
---> Running in ec387b3920a3
---> a441dd475d5f
Removing intermediate container ec387b3920a3
Step 11 : ENV GIT_SHA a0f6d450f3914c86e64687f3e0d56b6f57e46f6f
---> Running in f6903d7e56ab
---> 292a550b53a5
Removing intermediate container f6903d7e56ab
Successfully built 292a550b53a5
-----> Pushing image to private registry
-----> Launching...
! ERROR: Failed to launch container
! {"detail": "JSON parse error - Invalid \\escape: line 1 column 247 (char 246)"}
To ssh://[email protected]:2222/dockerfile-singleline.git
1d735a0..a0f6d45 master -> master
The work-around for the moment is to change the line continuations to a single huge run-on line.
ping @bacongobbler
I have a feeling that this has to do with how we serialize the Dockerfile in the builder. Nice catch!
Thanks guys for working on this issue. Meanwhile I'll avoid using multi-lines in dockerfiles while this gets fixed.