pdftron html2pdf sample can't work on k8s? - kubernetes

run from this Dockerfile
FROM centos:8
USER root
WORDDIR /root
RUN yum install -y wget java-1.8.0-openjdk-devel.i686
RUN wget https://www.pdftron.com/downloads/PDFNetC64.tar.gz
RUN tar xvfz PDFNetC64.tar.gz
RUN cd PDFNetC64/Samples/HTML2PDFTest/JAVA
CMD ["/bin/bash", "RunTest.sh"]
The result is perfect, pdfs can be generated.
However, if I deploy the docker image in a k8s (UI: rancher) env, then it stopped working, the screenshot is:
So could anybody give me some clue? I am doubting there is some special settings in k8s, and because pdftron is calling native so library by JNI, so is there anything I need to pay attention to?
Any idea is appreciated, thanks guys.

Related

how do i install Aerospike REST Gateway?

i want to use REST from aerospike because its said language agnostic, im using Ubuntu 20. im trying to understand intallation part here :
https://github.com/aerospike/aerospike-rest-gateway
https://github.com/aerospike/aerospike-rest-gateway/blob/master/docs/installation-and-config.md
but its soo unclear what to do first and they jumps to "./gradlew build" at start. i put mindlessly to terminal its show like this, totally no clue
# ./gradlew build
bash: ./gradlew: No such file or directory
There are a few ways to run the REST Gateway.
You can clone the repo's master branch and build it yourself. You can then run the jar file as shown in the readme.
make build
java -jar build/libs/aerospike-rest-gateway-<VERSION>.jar --aerospike.restclient.hostname=<aerospike-host>
Download the already built jar from the download page or download it using
wget https://download.aerospike.com/artifacts/aerospike-client-rest/<VERSION>/aerospike-client-rest-<VERSION>.tgz
Untar the archive
tar -xzf aerospike-client-rest-<VERSION>.tgz
Run the jar
java -jar aerospike-client-rest-2.0.1/as-rest-client-<VERSION>.jar --aerospike.restclient.hostname=<aerospike-host>
Use docker:
docker run -itd --rm -p 8080:8080 --name AS_Rest1 -e aerospike_restclient_hostname=<aerospike-host> aeropsike/aerospike-rest-gateway:latest
Note 1: These examples assume security is disabled.
Note 2: The REST client was recently renamed the REST Gateway, which is the reason for the differing artifact names.
As far as why ./gradlew build is not running, it is a bit hard to tell. Running ./gradlew build assumes you cloned the repo and the repo is your current working directory. If you provide more info about your CWD and the steps you have followed up to this point I can help further.

nvidia-docker - can cuda_runtime be available while building a container?

While attempting to compile darknet in the build command of a docker container I constantly run into the exception include/darknet.h:11:30: fatal error: cuda_runtime.h: No such file or directory.
I am building the container from the instructions here: https://github.com/NVIDIA/nvidia-docker/wiki/Deploy-on-Amazon-EC2. I have a simple Dockerfile I am testing with - the relevant parts:
FROM nvidia/cuda:9.2-runtime-ubuntu16.04
...
WORKDIR /
RUN apt-get install -y git
RUN git clone https://github.com/pjreddie/darknet.git
WORKDIR /darknet
# Set OpenCV makefile flag
RUN sed -i '/OPENCV=0/c\OPENCV=1' Makefile
RUN sed -i '/GPU=0/c\GPU=1' Makefile
#RUN ln -s /usr/local/cuda-9.2 /usr/local/cuda
# HERE I have been playing with commands to show me the state of the docker image to try to troubleshoot the problem
RUN find / -name "cuda_runtime.h"
RUN ls /usr/local/cuda/lib64/
RUN less /usr/local/cuda/README
RUN make
Most of the documentation I see references using the nvidia libraries when running a container, but the darknet compiles differently when built with gpu support so I need cuda_runtime.h available at build time.
Perhaps I misunderstand what nvidia-docker is doing - I'm assuming that nvidia-docker exists because the Nvidia code must be installed on the actual host machine and not inside the container & they use some mechanism to share the "native" code with the containers so the GPU can be managed - is that correct?
Should I even be trying to build darknet when building my container or should I be installing it on the host machine, then making it available somehow to the container? This seems to go against the portability of the containers but I can live with some constraints to get access to the GPU.
FROM nvidia/cuda:9.2-runtime-ubuntu16.04
Your image only has bits and pieces of CUDA-9.2 needed to run a CUDA app, but does not have the bits needed to build one.
You need to use -devel variant.

Webtatic PHP7.1 is missing

After installing PHP7.1 using this on CentOS7
https://webtatic.com/packages/php71/
Running
php -v
Results in
-bash: php: command not found
The install worked but PHP is not there - have I missed a step?
Since you have installed php from webtatic, you'll need to install the cli SAPI.
To do that you need to run:
sudo yum install php71w-cli
After the installation, try running the below to see if it works:
php --version
https://webtatic.com/packages/php71/
Contained in the php71w-cli package, this SAPI allows running scripts from the command-line, and also has a built-in web server for development-use. Located at /usr/bin/php
I had similar issues on my computer. For me the command was just renamed to php7 or php71. So if have the same issue please create a symlink.
Find out where your php7 file is residing
$ which php7
/usr/bin/php7
Symlink this file
sudo ln -s /usr/bin/php7 /usr/bin/php
Test that this is working
php -v
Your problem should be solved. Only case might be that you need to change newly created file as executable or change the owner/group.
Please let me know if this was helpful.

Cannot get postgresql-9.3-postgis-2.1 on Ubuntu 14.04.1 Docker container

I tried to install postgresql-9.3-postgis-2.1 or postgresql-9.1-postgis-2.1 for a cloned app, but I can only get postgresql-9.4-postgis-2.1 on my Ubuntu docker image which is build from python:2.7 image.
I looked into the image and found it's on a Ubuntu 14.04.1 image. I tries to install postgis on my Xubuntu 14.04.2 VM, everything is OK.
How could I get the installation works OK?
Dockerfile is pretty easy:
FROM python:2.7
RUN mkdir /workspace
RUN mkdir /data
WORKDIR /workspace
RUN apt-get update
RUN apt-get install postgresql postgresql-common postgresql-9.3-postgis-2.1
Error code is very normal too:
E: Unable to locate package postgresql-9.3-postgis-2.1
E: Couldn't find any package by regex 'postgresql-9.3-postgis-2.1'
Please provide more information, like the dockerfile and the errors you get.
From your comment it appears you load the python libraries before the postgresql libraries. I assume that your python app needs postgresql access and that it uses one of the python wrappers around the postgresql C libraries.
If that is the case then install the postgresql libraries before installing the python libraries, and do not forget to add the -dev libraries.
What I do in such a case is to make a minimal docker image, start a root shell in the container and do the install manually, take notes and use them to update the docker file. Alternatively you can run
$ docker exec -t -i bash -i
to get a shell in the container and try out what needs to be done.
Thanks for everyone who tried to help me! Though I finally fix this myself, there is nothing wrong with the Dockerfile which is pretty simple, but the image I chose is not a typical Ubuntu image, the docker office use buildpack-deps:jessie instead of ubuntu:14.04 image:
https://github.com/docker-library/python/blob/master/2.7/Dockerfile
It caused different behavior in docker and Ubuntu VM.
Finally, I build a Python image from Ubuntu:12.04 and fixed this issue.

Docker workflow for scientific computing

I'm trying to imagine a workflow that could be applied on a scientific work environment. My work involves doing some scientific coding, basically with Python, pandas, numpy and friends. Sometimes I have to use some modules that are not common standards in the scientific community and sometimes I have to integrate some compiled code in my chain of simulations. The code I run is most of the time parallelised with IPython notebook.
What do I find interesting about docker?
The fact that I could create a docker containing my code and its working environment. I can then send the docker to my colleges, without asking them to change their work environment, e.g., install an outdated version of a module so that they can run my code.
A rough draft of the workflow I have in mind goes something as follows:
Develop locally until I have a version I want to share with somebody.
Build a docker, possibly with a hook from a git repo.
Share the docker.
Can somebody give me some pointers of what I should take into account to develop further this workflow? A point that intrigues me: code running on a docker can lunch parallel process on the several cores of the machine? e.g., an IPython notebook connected to a cluster.
Docker can launch multiple process/thread on multiple core. Multiple processes may need the use of a supervisor (see : https://docs.docker.com/articles/using_supervisord/ )
You should probably build an image that contain the things you always use and use it as a base for all your project. (Would save you the pain of writing a complete Dockerfile each time)
Why not develop directly in a container and use the commit command to save your progress on a local docker registry? Then share the final image to your colleague.
How to make a local registry : https://blog.codecentric.de/en/2014/02/docker-registry-run-private-docker-image-repository/
Even though you'll have a full container, I think a package manager like conda can still be a solid part of the base image for your workflow.
FROM ubuntu:14.04
RUN apt-get update && apt-get install curl -y
# Install miniconda
RUN curl -LO http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh
RUN bash Miniconda-latest-Linux-x86_64.sh -p /miniconda -b
RUN rm Miniconda-latest-Linux-x86_64.sh
ENV PATH=/miniconda/bin:${PATH}
RUN conda update -y conda
* from nice example showing docker + miniconda + flask
Wrt doing source activate <env> in the Dockerfile you need to:
RUN /bin/bash -c "source activate <env> && <do something in the env>"