Getting the slug name for Digital Ocean’s images with doctl

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You would like to get a list of the available images in Digital Ocean, in order to be able to use them in creating your Terraform IAC script.

Solution

By installing the command line tool doctl, (instructions here), according to the documentation (after authenticating) you can run:

But the available images are not listed. In order to be list all the images you have to add the –public option (as described here) :

Use tee command to send output to a file and email

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You would like to send the error output from a command or a script to both an error file and an email.

Solution

By using tee, you could do the following:

Bash script to add environment and date in Symfony appversion.yml file

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You are using CI/CD to deploy a Symfony application that has the appversion.yml configuration file, and you want to add the environment and a timestamp to it after deployment.

Solution

You can achieve this by creating and running a bash script like the following and passing the environment as a variable (ie script_name env) :

FATAL -> Failed to fork – Digital Ocean – Debian – Docker

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

When you are trying to install a package inside a debian Docker container you get the following error message:

Solution

This is an indication of ‘out of memory’ so add a swap partition if it does not exist, on the host with the following:

(Thanks Valent)

Docker – Debian – Kernel panick – Automatic restart

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You have a remote server (Debian) running some Docker containers and you want to make sure that they all restart in the event of a kernel panick.

solution

  • Add an automatic restart after a kernel panick by running:

  • Emulate a kernel panick by running the following (SysRq more info here :

  • Check that the containers have restarted again with docker ps (NOTE: the containers should have been enabled to autorestart)

Docker Debian locales installation

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You want to install some default locales in a Docker image, and the suggestion is to use locale-gen to do so, but it does not work as expected.

Solution

In order to be able to use the locale-gen and install the locales you need you will have to uncomment the ones needed from /etc/locale.gen first and then use the locale-gen. Example below: