Probably because there is no shebang on the script? And does it have exec permission? The error said it didn't recognize it..
Also, you don't specify the location of the script to run. You use command: [ "/bin/sh", "copy.sh" ] But probably copy.sh is not in the PATH, so you need to use "/copy.sh". Does that fix it? On Wednesday, September 14, 2016, Derek Mahar <[email protected]> wrote: > Why does the following container fail due to FailedPostStartHook? > > # Image javaqa:5000/opessoftware/platinum-fix-brvm:1.1.0-SNAPSHOT > > FROM busybox > > # Add BRVM configuration files. > ADD brvm/* /config/ > > # Add script to copy configuration files into shared volume. > ADD copy.sh / > > VOLUME /etc/opes/platinum/fix/brvm > > # Run script. > CMD ["tail" "-f" "/dev/null"] > > --- > > # Pod defintion > > apiVersion: v1 > kind: Pod > metadata: > name: platinum-fix > spec: > containers: > > - name: fix-brvm > image: javaqa:5000/opessoftware/platinum-fix-brvm:1.1.0-SNAPSHOT > imagePullPolicy: Always > volumeMounts: > - name: fix-brvm-config > mountPath: /etc/opes/platinum/fix/brvm > lifecycle: > postStart: > exec: > command: [ "/bin/sh", "copy.sh" ] > > volumes: > - name: fix-brvm-config > emptyDir: {} > > --- > > derek@derek-HP-EliteOne-800-G1-AiO:~/Projects/platinum/ > platinum-fix-group/platinum-fix/src/main/kubernetes$ kubectl create -f > platinum-fix-pod-2.yaml > pod "platinum-fix" created > derek@derek-HP-EliteOne-800-G1-AiO:~/Projects/platinum/ > platinum-fix-group/platinum-fix/src/main/kubernetes$ kubectl describe pod > platinum-fix > Name: platinum-fix > Namespace: default > Node: 172.17.4.201/172.17.4.201 > Start Time: Wed, 14 Sep 2016 13:56:14 -0400 > Labels: <none> > Status: Running > IP: 10.2.89.15 > Controllers: <none> > Containers: > fix-brvm: > Container ID: docker://01d0159aff38756663044720afacd8 > 5cba4386d24ce0776c52f8cfa871fa125e > Image: javaqa:5000/opessoftware/platinum-fix-brvm:1.1.0- > SNAPSHOT > Image ID: docker://sha256:f54145b319cfc7bb18be0c355126ca > ede6217c262f2d4f84f2d69fbaaa74cc61 > Port: > State: Waiting > Reason: CrashLoopBackOff > Last State: Terminated > Reason: Error > Exit Code: 127 > Started: Wed, 14 Sep 2016 13:56:16 -0400 > Finished: Wed, 14 Sep 2016 13:56:16 -0400 > Ready: False > Restart Count: 1 > Environment Variables: <none> > Conditions: > Type Status > Initialized True > Ready False > PodScheduled True > Volumes: > fix-brvm-config: > Type: EmptyDir (a temporary directory that shares a pod's lifetime) > Medium: > default-token-1lggo: > Type: Secret (a volume populated by a Secret) > SecretName: default-token-1lggo > QoS Tier: BestEffort > Events: > FirstSeen LastSeen Count From SubobjectPath > Type Reason Message > --------- -------- ----- ---- ------------- > -------- ------ ------- > 9s 9s 1 {default-scheduler } > Normal Scheduled Successfully assigned platinum-fix to > 172.17.4.201 > 8s 8s 1 {kubelet 172.17.4.201} > spec.containers{fix-brvm} Normal Started Started > container with docker id c6fbd5b818a3 > 8s 8s 2 {kubelet 172.17.4.201} > spec.containers{fix-brvm} Normal Pulling pulling image > "javaqa:5000/opessoftware/platinum-fix-brvm:1.1.0-SNAPSHOT" > 8s 8s 1 {kubelet 172.17.4.201} > spec.containers{fix-brvm} Normal Created Created > container with docker id c6fbd5b818a3 > 8s 8s 1 {kubelet 172.17.4.201} > spec.containers{fix-brvm} Normal Killing Killing > container with docker id c6fbd5b818a3: PostStart handler: Unrecognized > input header > 8s 7s 2 {kubelet 172.17.4.201} > spec.containers{fix-brvm} Warning FailedPostStartHook > 8s 7s 2 {kubelet 172.17.4.201} > spec.containers{fix-brvm} Normal Pulled Successfully > pulled image "javaqa:5000/opessoftware/platinum-fix-brvm:1.1.0-SNAPSHOT" > 8s 7s 2 {kubelet 172.17.4.201} > Warning FailedSync Error syncing pod, skipping: failed to > "StartContainer" for "fix-brvm" with RunContainerError: "PostStart handler: > Unrecognized input header" > > 7s 7s 1 {kubelet 172.17.4.201} spec.containers{fix-brvm} > Normal Created Created container with docker id 01d0159aff38 > 7s 7s 1 {kubelet 172.17.4.201} spec.containers{fix-brvm} > Normal Started Started container with docker id 01d0159aff38 > 7s 7s 1 {kubelet 172.17.4.201} spec.containers{fix-brvm} > Normal Killing Killing container with docker id 01d0159aff38: > PostStart handler: Unrecognized input header > 6s 5s 2 {kubelet 172.17.4.201} spec.containers{fix-brvm} > Warning BackOff Back-off restarting failed docker container > 6s 5s 2 {kubelet 172.17.4.201} Warning > FailedSync Error syncing pod, skipping: failed to "StartContainer" for > "fix-brvm" with CrashLoopBackOff: "Back-off 10s restarting failed > container=fix-brvm pod=platinum-fix_default(876c61bc-7aa4-11e6-a592- > 0800278ab84d)" > > -- > You received this message because you are subscribed to the Google Groups > "Kubernetes user discussion and Q&A" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <javascript:_e(%7B%7D,'cvml','kubernetes-users%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > Visit this group at https://groups.google.com/group/kubernetes-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/kubernetes-users. For more options, visit https://groups.google.com/d/optout.
