appsody / stacks

Appsody application stacks. This repo will be archived soon.
https://appsody.dev
Apache License 2.0
90 stars 120 forks source link

Can't appsody build on OpenShift 3.11 (copy doesn't support chown flag, docker version related) #102

Open a-roberts opened 5 years ago

a-roberts commented 5 years ago

Describe the bug I'd like to be able to appsody build my Node.js Express stack on OpenShift 3.11.

Unfortunately the Docker version I'm running is too old for at least the --chown flag to be recognised (and I'm guessing this is the Docker version that comes with OpenShift 3.11, it certainly does on my system I've provisioned), and I'm concerned other features can't be satisfied either so we should take a look

[root@solan1 my-project]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-74.git6e3bb8e.el7.x86_64
 Go version:      go1.9.2
 Git commit:      6e3bb8e/1.13.1
 Built:           Wed Aug  1 16:56:40 2018
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-74.git6e3bb8e.el7.x86_64
 Go version:      go1.9.2
 Git commit:      6e3bb8e/1.13.1
 Built:           Wed Aug  1 16:56:40 2018
 OS/Arch:         linux/amd64
 Experimental:    false

An appsody build command gives us:

[Docker] Setting up debian-archive-keyring (2017.5+deb9u1) ...
[Docker] Removing obsolete conffile /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg ...
[Docker] Removing obsolete conffile /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg ...
[Docker] Finished installing dependencies
[Docker]  ---> 407ae54e6e54
[Docker] Removing intermediate container 7c86e31399c8
[Docker] Step 12/19 : COPY --chown=node:node . /project
[Docker] Unknown flag: chown
[Error] Error running docker command: exit status 1

To Reproduce Steps to reproduce the behavior:

  1. Use OpenShift 3.11 (I'm using an IBM provided stack)
  2. wget https://github.com/appsody/appsody/releases/download/0.2.5/appsody-0.2.5-1.x86_64.rpm .
  3. yum install ./appsody-0.2.5-1.x86_64.rpm
  4. mkdir /dev
  5. cd /dev
  6. mkdir my-project
  7. chcon -Rt svirt_sandbox_file_t /dev
  8. cd my-project
  9. appsody init nodejs-express
  10. appsody build

Expected behavior I expected this to work fine with the pre-reqs of OpenShift 3.11, so perhaps we should use the legacy approach defined here. Or, we need to clearly document that users need an updated Docker version. Or maybe my OpenShift provisioned Stack shouldn't be giving me such an old version and it's an issue with our stack provisioner configuration.

Actual behaviour I can't appsody build. I wanted to appsody build to get appsody-service.yaml to push to my GitHub repo to eventually deploy through Tekton.

Environment Details (please complete the following information):

If applicable please specify:

Other details https://github.com/appsody/stacks/blob/master/incubator/nodejs-express/image/project/Dockerfile#L34

I'll do this all locally instead next with my good Docker version, but shouldn't we be able to build on OpenShift using Docker as well or should we instead be using an alternative like buildkit, buildah or Kaniko?

neeraj-laad commented 5 years ago

@a-roberts Thanks for raising this issue. It seems the systems you get with OpenShift 3.11 have a docker version below the version we support on Appsody.

Changing all the stacks to use older syntax might be a lot of work.

I'd like to understand if there are mechanisms to get a newer version of docker, with OpenShift?

Alternatively, can we add additional checks in the cli to detect the docker version and help with the upgrade before we get too far?

@appsody/cli

ebullient commented 5 years ago

OpenShift Container Platform 3.11 is supported on Red Hat Enterprise Linux 7.4 
and later with the latest packages from Extras, including CRI-O 1.11 and 
Docker 1.13. It is also supported on Atomic Host 7.5 and later.

chown issue is mentioned in the bugfix: https://access.redhat.com/errata/RHBA-2018:2652

nkseto commented 5 years ago

I had a similar issue in that I wasn't able to get my node app running in OpenShift 3.11 but a different error. When I tried to deploy the appsody build into OpenShift 3.11 I got an error similar to Error: EACCES: permission denied, mkdir '/project/xxx'. I was able to resolve it by doing the following:

  1. Forked my own node-expressjs stack.
  2. Updated the dockerfile contents to contain the postings from https://stackoverflow.com/questions/42363105/permission-denied-mkdir-in-container-on-openshift (in particular Update 2) to resolve the above issue.

Doing the two above allowed me to deploy my app successfully.