Globally replace a placeholder with sed

sed -i [replace command] file


sed -i s/MINISHIFT_IP/ my-config-file.yml

You can even do:

sed -i s/MINISHIFT_IP/$(minishift ip)/g my-config-file.yml

More info about sed:


Docker – to be continued

Building from Dockerfile

docker build [directory with Dockerfile]

Example Dockerfile:

FROM fedora:25

RUN dnf install -y java-1.8.0-openjdk git maven mc vim unzip \
&& cd /tmp && git clone swarm

WORKDIR /tmp/swarm

ENTRYPOINT mvn clean install

FROM specifies a parent image

RUN specifies a command that is run during the image build. The results of the command are stored in the image.
One can put multiple RUNs in a Dockerfile, but each will result in a new layer/image. It makes sense if you have a part of RUN that you are unlikely to modify. This will result in reusing of the layer from the first build in the consecutive builds, thus speeding up your work.

ENTRYPOINT is executed after container start. It is executed regardless of any command provided by docker run.
If you don’t want to run the start-up code in the case a user provides some run command, use CMD instead.
One can mix ENTRYPOINT with CMD, more details about the two:


docker run [image name]

To get into container’s bash:

docker run -it [image name] bash

To resurrect a container:
commit a stopped container:

docker commit [container sha] tmp

Start the container (in the example below, overriding entrypoint, because it was already ran):

docker run -ti --entrypoint=/bin/bash tmp

Sharing files between host and container

Mounting a host directory into a container:

docker run -v [host directory]:[container directory] [image name]

If you have problems accessing the shared directory, especially on CentOS, you might need to add “:z” to the command:

docker run -v [host directory]:[container directory]:z [image name]

Copying files from docker to host (may be working both ways in new versions):

docker cp [container]:[container file/directory] [host target]

phantom This application failed to start because it could not find or load the Qt platform plugin “xcb”.

If you encounter this issue, it’s a bug in phantomjs that prevents it from working properly when QT_QPA_PLATFORM environment variable is set.

The best way to solve this issue is to upgrade to the newest phantom, but if you cannot do it, you can unset the variable:
or give it an empty value, e.g.:

If you don’t want to type the command every time, you can one of the above to .bashrc or .profile

Here’s one of the related issues on GitHub:

Invoking angular stuff from console

To get an angular service in chrome console you can use:


This will get you a service object.


To get to angular scope, inspect an element, for which you want to get the scope and invoke: angular.element($0).scope()


PostgreSQL on Fedora: psql: FATAL: Ident authentication failed for user “username”

Usually, to add a user to postgres, you have to run psql as user postgres and create user as such.

On Ubuntu it’s enough to let you log in as a newly created user to the DB, but it’s not enough on Fedora. Here psql responds with the error from the subject.

To fix it add the following line to pg_hba.conf (on F23: /var/lib/pgsql/data/pg_hba.conf):

local   all             all                           md5

Line above is for socket configuration. If you need IP access too, add:

host    all             all       md5