Skip to content

Instantly share code, notes, and snippets.

@plavjanik
Last active June 19, 2023 23:40
Show Gist options
  • Save plavjanik/324395abe5636bf978d1c614586888ad to your computer and use it in GitHub Desktop.
Save plavjanik/324395abe5636bf978d1c614586888ad to your computer and use it in GitHub Desktop.
Zowe CLI Dockerfile
FROM node:16
# Directory where Zowe CLI settings and plug-ins will be stored:
RUN mkdir /zowe
WORKDIR /zowe
ENV ZOWE_CLI_HOME=/zowe
# Install requirements of Zowe CLI Secure Credential Store:
RUN DEBIAN_FRONTEND=noninteractive apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y libsecret-1-dev gnome-keyring dbus-x11
# Install Zowe CLI:
RUN npm install -g @zowe/cli@next
# Install Zowe CLI plug-ins:
RUN zowe plugins install @broadcom/endevor-for-zowe-cli@next
# Enable daemon mode:
RUN zowe daemon enable
ENV PATH=/zowe/bin:${PATH}
# Working directory for the users of the image:
RUN mkdir /workspace
WORKDIR /workspace
# Use entry point that initialized dbus and gnome-keyring-daemon for Zowe secure credential store and starts Zowe CLI daemon:
COPY ./docker-entrypoint.sh /zowe/
RUN chmod a+x /zowe/docker-entrypoint.sh
ENTRYPOINT [ "dbus-run-session", "--", "/zowe/docker-entrypoint.sh" ]
CMD ["zowe-init"]
@plavjanik
Copy link
Author

I will add this command after the COPY command to ensure that shell script is executable:

RUN chmod a+x /zowe/docker-entrypoint.sh

@dickywmc
Copy link

dickywmc commented Jun 16, 2023

Thanks @plavjanik , I got the same suggestion from others too, but even after adding the CHMOD line and rebuilding the docker image, it still fails with the same error:
dbus-run-session: failed to exec '/zowe/docker-entrypoint.sh': No such file or directory

Looks like it is unable to find file rather than lacking permission to execute.

P.S. I am running under Windows 10, but my friend running the same thing under Linux does not encounter any problem.

@plavjanik
Copy link
Author

The updated version that does not use the credentials manager at all is at https://github.com/plavjanik/zowe-cli-dockerfiles/tree/main/zowe-cli-v2

I have not tested it on Windows yet.

@dickywmc
Copy link

Thanks Petr. I just tried on Windows but the same error persists (I removed -d so that any error will pop up immediately):

PS C:\Users\ManChunDickyWong\Jenkins> docker run --platform=linux/amd64 --name=zowe-cli --rm -it --mount type=bind,source="$PWD",target=/workspace,consistency=delegated zowe-cli:local
exec /zowe/docker-entrypoint.sh: no such file or directory

@plavjanik
Copy link
Author

I am not able to try it now. This seems as one of the possible problems on Windows - https://stackoverflow.com/questions/53165471/building-docker-images-on-windows-entrypoint-script-no-such-file-or-directory

@dickywmc
Copy link

Thanks Petr for your help! The issue is resolved by using Notepad++ to change CRLF to LF on the script file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment