Wkhtmltopdf in a Dokku app? - docker

I have a NodeJS/Express Dokku container. I'm trying to use a node module which just runs the wkhtmltopdf command from shell, but it can't find wkhtmltopdf.
Anyone have any experience with this?

You need to check how wkhtmltopdf was installed in that image.
As mentioned in node-wkhtmltopdf issues 32:
The wkhtmltopdf command is executed as a shell command on non-Windows systems.
Make sure the /usr/local/bin directory is in your $PATH variable. Do this by running:
$ sh
sh-3.2$ which wkhtmltopdf # Or try:
sh-3.2$ echo $PATH
sh-3.2$ exit
(In your case, you can do a sudo docker exec -it <containerIdOrName> sh)
The same issue adds:
What I ended up doing was downloading the dmg directly from wkhtmltopdf and that seemed to do the trick.
That means you might have to create a new image from the current one, installing wkhtmltopdf that way (with the dmg package)
jsonfry what installing wkhtmltopdf as a service container means: openlabs/docker-wkhtmltopdf-aas illustrates the installation process.

I got into the same issue as you did. I didn't want to run wkhtmltopdf in another container nor did I want to change the code to use remote calls. Since downloading wkhtmltopdf using apt-get plugin may result in a package that throws errors, I have created a new plugin that should set up wkhtmltopdf in the dokku container for you.
It is licensed using MIT license so feel free to do whatever you want. Hopefully it will help somebody.
URL: https://github.com/mbriskar/dokku-wkhtmltopdf

Related

How do I run a script file in Windows?

I am trying to build Pyodide from source on Windows. In their documentation they recommend using Docker. From the documentation:
1 Install Docker
2 From a git checkout of Pyodide, run ./run_docker or ./run_docker --pre-built
3 Run make to build.
I don't understand how to run ./run_docker?
I don't even know exactly what the file is. Is it a shell script?
Combining your question, "How do I run a script file in Windows?", with the information provided (you want to run a file called run_docker from the Pyodide project) you should get started by installing the Windows Subsystem for Linux version 2 (WSL). After you install WSL, you will need to open a command prompt, run bash to enter the Ubuntu linux distribution. From here you should follow the steps for building on Linux. When you run into a problem you can search the internet for solutions related to "Linux" or "Ubuntu".

How to remove a snap application (docker) completely

I made the mistake of installing Docker via Snap... Once I realised that snap hadn't permissions to run in my working directory (on a different partition), I removed it. Now I can't use docker after I've installed it via apt-get.
Please help.
I've done sudo snap remove docker but when I sudo apt install docker and run via docker, I get bash: /snap/bin/docker: No such file or directory
The command you are looking for is:
sudo apt install docker.io
i.e it's docker.io not just docker
On Ubuntu, the package docker is described as a "System tray for KDE3/GNOME2 applications", which is probably not what you want!
I had the same problem. This works for me.
sudo snap remove docker
sudo reboot
the point is to restart the instance or terminal.
I hope this method can help
I did the same and just restarting the instance fixed it.
The problem is simply that your bash shell caches the locations of known executables, in order to avoid having to scan through your executables search path (that is, the directories listed in $PATH) every time you type a command. Because you have removed the executable from one directory (/snap/bin) and added it to another directory (/usr/bin), this cache is now out of date. This means that it will look in the wrong location if you try to invoke the executable simply by typing docker rather than its full path.
It is possible to fix it simply by starting a new bash shell, for example open a new terminal window and type the command in there.
Alternatively if you wish to refresh the cache in the terminal session that you are already using, type:
hash -r
It is not necessary to restart your computer (although this would also work).

"bash: aws: command not found" on Windows 7 in Git Bash

I'm trying to use AWS CLI to access CodeCommit. And it's sort of working. I am able to use the aws command in the Windows command prompt. However, when I try to access it using the Git Bash shell, it says
"bash: aws: command not found."
Additionally, when I try to do do a git clone in the Windows command promt, trying to access CodeCommit, it tries to use aws using the credentials helper, which also results in "aws: command not found."
I followed the instructions in the AWS documentation, which suggests some directories to add to the PATH:
https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-windows.html#awscli-install-windows-path
Here's what my PATH variable looks like:
C:\Users\ddrayton\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\ddrayton\AppData\Local\Programs\Python\Python36\;C:\Windows\System32;;C:\Program
Files\Docker
Toolbox;C:\Users\ddrayton\MyCurl;%USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts;C:\Program
Files\Amazon\AWSCLI;C:\Program Files
(x86)\Amazon\AWSCLI;C:\Users\ddrayton\AppData\Local\Programs\Python\Python36;C:\Users\ddrayton\AppData\Local\Programs\Python\Python36\Scripts
But I'm not sure if it's a PATH problem, since the Windows command prompt has no problem accessing the "aws" command.
Any ideas?
Fixed this by simply installing the AWS CLI again but this time using Git Bash instead of the Windows command prompt.
pip install awscli
If anyone could provide some insight as to why this was necessary, it would be appreciated.
In my case, I think a recent-to-me update to the AWS CLI changed what's run to being aws.cmd (full path C:\Program Files\Amazon\AWSCLI\bin\aws.cmd)
Git Bash needs the extension aws.cmd to make it work.
In Bash, you could try typing aws.cmd vs aws. If the former works, but not the latter, you can do alias aws='aws.cmd' in your bash startup script. I don't know if it's the best solution, but it worked for me.
FWIW, I think it's related to this:
https://unix.stackexchange.com/questions/280528/is-there-a-unix-equivalent-of-the-windows-environment-variable-pathext
On Windows 10 I was installing just once from GitBash via pip install awscli --upgrade --user as described in AWS manual for CLI installation for Linux
It installed aws executables into %USERPROFILE%\AppData\Roaming\Python\Python37\Scripts
After that just add this folder to your PATH. Re-open GitBash or cmd - it should work from both places

How to install wkhtmltopdf for docker

I'm using wkhtmltopdf for nodejs, followed instructions for windows installation (and added it to PATH after installation). When i start my app through bash, it works just fine as it should. I manage to convert html to pdf.
But it doesnt work when im using docker, like it doesnt even exists. Im assuming there is some other way to install it for docker, or some way to add PATH to docker?? Any other ideas? hints?
And before u say it, been googling it and looking for images and installations for docker, none helped. Got one that u know it works?
Anyways for all the others that found themselves in the same pickle... I was trying to use wkhtmltopdf within docker container while wkhtmltopdf was only installed and executable within system (windows/linux) environment and not in the actual docker environment... after updating dockerfile to automatically install wkhtml with the build, I also had to SET THE PATH.. for linux docker smth like this
cp wkhtmltox/bin/* /usr/local/bin/ &&
that made everything works just as it should.

How to install Cloud Foundry CLI on Ubuntu

I am a docker newbie.
I have an ubuntu image and wanted to install Cloud Foundry CLI on it and am unable to do so.
I downloaded the binary for CF CLI from https://github.com/cloudfoundry/cli/releases and untarred it. The untar is successful but I am unable to run the CLI.
When i run the cf i get /bin/sh: ./cf: not found message.
A couple ways to do this. Edit your path. Place the following in ~/.bash_profile or ~/.bashrc.
PATH=$PATH:/path/to/directory/containingcf
Or put cf in /usr/bin/ or somewhere that is already on your path.
If cf executable in current directory just use "./cf".
In general it is better to place cf executable somewhere in your PATH.
Please make sure the cf file has executable permissions and it is suitable for your OS architecture (e.g. Boot2Docker 1.5.0 works only with "Linux 32 bit" cf binary).

Resources