Header Image - /dev/blog

How to commit MariaDB/Mysql Docker image with pre-populated data set

by djagielo 0 Comments
How to commit MariaDB/Mysql Docker image with pre-populated data set

If you have a task to prepare Docker database image with pre-populated data it seems to be pretty easy. It actually is, but you need to know how to preserve data between runs. If your database stores data in directory that is a volume (I’m sure it’s true for MySQL/MariaDB and Postgres) it’s going to be empty in committed image. That was my first mistake.

After that I started the database image using docker-compose, started importing script and after few hours I had https://www.imdb.com database in my docker image.

Then I committed the image and created a tag. However, after killing that image and starting the new one, tagged one I lost my whole work cause database was empty. Why? Because of the volume mechanism that I wasn’t aware of.

Now let’s do it right.

Steps to create prepopulated MariaDB/MySQL image:

  1. Prepare Dockerfile that configures MariaDB/MySQL to store data in different folder (see the code listing below)
  2. Start container and import the data, you can use e.g. importing scripts mounted as volume to your container
  3. Obtain id of an image
  4. Commit image with your tag, for me it was: docker commit <ID> djagielo/mariadb-employees:latest
  5. Login to your Docker registry: docker login -u <USER>
  6. Push image: docker push djagielo/mariadb-employees:latest

Dockerfile and docker-compose:

If you’re looking for quite big dataset, you may be interested in datasets of IMDB service. Dumps are available for free right here: https://datasets.imdbws.com

Angular 6 – How to debug ‘[object ErrorEvent] thrown’ in Karma tests? What about ng test –single-run?

by djagielo 0 Comments
Angular 6 – How to debug ‘[object ErrorEvent] thrown’ in Karma tests? What about ng test –single-run?

I was writing about the similiar problem in case of Angular v4 in the post named How to debug ‘NetworkError: Failed to execute ‘send’ on ‘XMLHttpRequest” in Karma tests.
With Angular v6 error message is little different but still does not provide useful message. With Angular v6 a solution of this problems is also slightly different.

How to debug ‘NetworkError: Failed to execute ‘send’ on ‘XMLHttpRequest” in Karma tests

by djagielo 0 Comments
How to debug ‘NetworkError: Failed to execute ‘send’ on ‘XMLHttpRequest” in Karma tests

Running tests that fail without any useful information may be very frustrating. I faced this problem with Karma tests for Angular 4 application. I made few changes in my code and then got message: ‘Uncaught NetworkError: Failed to execute ‘send’ on ‘XMLHttpRequest’ with no explanation what’s wrong. It seems to be a Karma/Angular/CLI bug and for more details you need to use a bit hacky command to run tests.

Lenovo E540 fan does not stop issue solution

by djagielo 0 Comments
Lenovo E540 fan does not stop issue solution

Last year(June) I bought new laptop for me – it was Lenovo e540 with core i7. But all the time I had problem (like others Lenovo e540 users) with fan noise. When it started to spin once i was not going to stop even if computer was IDLE. Suspending computer was solution only for couple of seconds after laptop up.

How to install xrdp on Lubuntu server edition

by djagielo 0 Comments
How to install xrdp on Lubuntu server edition

Couple days ago I started to use my old PC as a home server. It has not good configuration but for home purposes it’s good enough(core i5, 16GB DDR3, 1TB HDD, Gigabit Ethernet). I’m going to install there some VMs for tests of my University project and also to try some technologies that are new for me: Jenkins and Docker.