Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker file permissions are wrong when building on Windows #1047

Open
stevemuk opened this issue Dec 11, 2015 · 7 comments
Open

Docker file permissions are wrong when building on Windows #1047

stevemuk opened this issue Dec 11, 2015 · 7 comments

Comments

@stevemuk
Copy link

If I take the generated DockerFile and build with docker command line it works, but warns you the permissions are all set +x. Should the maven plugin behave the same as the docker command line?

c:>mvn docker:build

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Fabric8 :: Quickstarts :: Java :: Simple main class 2.2.74-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.887 s
[INFO] Finished at: 2015-12-11T15:29:15+00:00
[INFO] Final Memory: 16M/253M
[INFO] ------------------------------------------------------------------------

c:>docker images

REPOSITORY                                 TAG                 IMAGE ID            CREATED              VIRTUAL SIZE
fabric8/quickstart-java-simple-mainclass   2.2.74-SNAPSHOT     26805d3f2ecc        About a minute ago   436.2 MB


c:>docker run 26805d3f2ecc
Executing /deployments/bin/run ...
/usr/local/s2i/run: line 13: /deployments/bin/run.sh: Permission denied
/usr/local/s2i/run: line 13: exec: /deployments/bin/run.sh: cannot execute: Permission denied
c:>cd target\docker\fabric8\quickstart-java-simple-mainclass\2.2.74-SNAPSHOT\build
c:>docker build -t foo:1 .

Sending build context to Docker daemon   450 kB
Step 1 : FROM fabric8/s2i-java:1.2.5
 ---> 82ae593a0b06
Step 2 : MAINTAINER [email protected]
 ---> Using cache
 ---> f5135182881d
Step 3 : ENV JAVA_LIB_DIR /deployments/lib JAVA_MAIN_CLASS io.fabric8.quickstarts.java.simple.Main
 ---> Using cache
 ---> 796e49474284
Step 4 : COPY maven /deployments/
 ---> 85d067d0e648
Removing intermediate container d2f72dfbf4e5
Successfully built 85d067d0e648
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permission
s. It is recommended to double check and reset permissions for sensitive files and directories.

c:>docker images
REPOSITORY                                 TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
foo                                        1                   85d067d0e648        5 minutes ago       436.2 MB
fabric8/quickstart-java-simple-mainclass   2.2.74-SNAPSHOT     26805d3f2ecc        16 minutes ago      436.2 MB

c:>docker run 85d067d0e648

Executing /deployments/bin/run ...
Launching application in folder: /deployments
Running  java  -javaagent:/opt/jolokia/jolokia.jar=config=/opt/jolokia/jolokia.properties,useSslClientAuthentication=true,extraClientCheck=true,protocol=https,caCert=/var/run/secre
ts/kubernetes.io/serviceaccount/ca.crt,clientPrincipal=cn=system:master-proxy -classpath .:/deployments/lib/quickstart-java-simple-mainclass-2.2.74-SNAPSHOT.jar:/deployments/lib/co
mmons-lang3-3.4.jar io.fabric8.quickstarts.java.simple.Main
Could not start Jolokia agent: java.lang.IllegalStateException: Cannot open keystore for https communication: java.io.FileNotFoundException: No such CA cert /var/run/secrets/kubern
etes.io/serviceaccount/ca.crt
Hello Fabric8! Here's your random string: 1JGTg
Hello Fabric8! Here's your random string: TWg8b
@chiippy
Copy link

chiippy commented Feb 4, 2016

Any update for this problem please ? thankx

@jimmidyson
Copy link
Contributor

Had this same issue, albeit on different platform. Solution was to specify fileMode of 0755 & mode of tar in Docker assembly. Similar to fabric8io/fabric8-devops@2a86960.

PR welcome with fix :)

@chiippy
Copy link

chiippy commented Mar 8, 2016

Possible of a fix for this problem ? We can't use the "s2i-java" image when compile on window platform because of this error. I have tried to use the inline assembly plugin to change the fileMode :

<fileSet> <directory>${project.build.directory}/hawt-app/bin</directory> <outputDirectory>/bin</outputDirectory> <includes> <include>*</include> </includes> <fileMode>0777</fileMode>

Unfortunately, this doesn't work neither.

Thanks

@jimmidyson
Copy link
Contributor

Have you also tried with mode of tar specified?

@chiippy
Copy link

chiippy commented Mar 9, 2016

Thanks Jimmi. Adding the "mode" works !
However, we have 20+ camel services and ideally, we would like to use the latest s2i-java images. Unfortunately, we don't have the luxury to choose our dev platform OS, so ideally if this can be fixed for window, then we can free from this work around will be nice. Thanks.

@jimmidyson
Copy link
Contributor

@rhuss Any thoughts? What's the reason for default mode of dir instead of tar?

@glennodickson
Copy link

Yes I can across the extact same error using fabric8/s2i-java

REPOSITORY                                     TAG                 IMAGE ID            CREATED             SIZE
172.30.22.18:5000/fabric8/camel-rest-client    1.0-SNAPSHOT        7b5a7a0ecf20        45 hours ago        447 MB
172.30.22.18:5000/fabric8/camel-rest-service   1.0-SNAPSHOT        07617a08511e        45 hours ago        572 MB
fabric8/s2i-java                               latest              3c42b2051105        7 days ago          430.2 MB
172.30.22.18:5000/myproject/test               latest              7968321274dc        2 weeks ago         1.11 MB
busybox                                        latest              7968321274dc        2 weeks ago         1.11 MB
openshift/origin-deployer                      v1.3.1              53fdd4ea7616        3 months ago        487.1 MB
openshift/origin-docker-registry               v1.3.1              95648ff9553f        3 months ago        345.5 MB
openshift/origin-haproxy-router                v1.3.1              760f28b9be63        3 months ago        506.2 MB
openshift/origin                               v1.3.1              5db3d6aa750d        3 months ago        487.1 MB
openshift/origin-pod                           v1.3.1              ab24f01f140d        3 months ago        1.591 MB
fabric8/tomcat-8.0                             latest              4094ef96fdfc        7 months ago        563.1 MB

**$ docker run 7b5a7a0ecf20**
Starting the application using the bundled /deployments/bin/run.sh ...
/usr/local/s2i/run: line 18: /deployments/bin/run.sh: Permission denied
/usr/local/s2i/run: line 18: exec: /deployments/bin/run.sh: cannot execute: Permission denied

Any solution to this yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants