Installing Docker on Ubuntu 18.04

Posted: 10 August 2018 in Docker

In this post i will put down the steps to install docker on Ubuntu 18.04.

Assumptions:

  • Installed os version is Ubuntu 18.04
  • Configured firewall
  • non-root sudo user available

Step 1 — Installing Docker

The Docker installation package available in the official Ubuntu repository may not be the latest version. To ensure we get the latest version, we’ll install Docker from the official Docker repository. To do that, we’ll add a new package source, add the GPG key from Docker to ensure the downloads are valid, and then install the package.

First, update your existing list of packages:

$ sudo apt update

Next, install a few prerequisite packages which let apt use packages over HTTPS:

$ sudo apt install apt-transport-https ca-certificates curl software-properties-common

Then add the GPG key for the official Docker repository to your system:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to APT sources:

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

Next, update the package database with the Docker packages from the newly added repo:

$ sudo apt update

Finally, install Docker:

$ sudo apt install docker-ce

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

$ sudo systemctl status docker

The output should be similar to the following, showing that the service is active and running:

Output
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-07-05 15:08:39 UTC; 2min 55s ago
     Docs: https://docs.docker.com
 Main PID: 10096 (dockerd)
    Tasks: 16
   CGroup: /system.slice/docker.service
           ├─10096 /usr/bin/dockerd -H fd://
           └─10113 docker-containerd --config /var/run/docker/containerd/containerd.toml

Installing Docker now gives you not just the Docker service (daemon) but also the docker command line utility, or the Docker client. We’ll explore how to use the docker command later in this tutorial.

Step 2 — Executing the Docker Command Without Sudo (Optional)

By default, the docker command can only be run the root user or by a user in the docker group, which is automatically created during Docker’s installation process. If you attempt to run the docker command without prefixing it with sudo or without being in the docker group, you’ll get an output like this:

Output
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.

If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

$ sudo usermod -aG docker ${USER}

 

To apply the new group membership, log out of the server and back in, or type the following:

$ su - ${USER}

 

You will be prompted to enter your user’s password to continue.

Confirm that your user is now added to the docker group by typing:

$ id -nG

 

The output should now state that you are in the docker group. If you need to add a user to the docker group that you’re not logged in as, declare that username explicitly using:

$ sudo usermod -aG docker username

 

The rest of this article assumes you are running the docker command as a user in the docker group. If you choose not to, please add sudo in front of the commands.

Let’s explore the docker command next.

Step 3 — Using the Docker Command

Using docker consists of passing it a chain of options and commands followed by arguments. The syntax takes this form:

$ docker [option] [command] [arguments]

 

To view all available subcommands, type:

$ docker

 

As of Docker 18, the complete list of available subcommands includes:

Output

  attach      Attach local standard input, output, and error streams to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes

 

To view the options available to a specific command, type:

$ docker docker-subcommand --help

 

To view system-wide information about Docker, use:

$ docker info

 

I will explore some of these commands in another blog post. We’ll start by working with images.

Advertisements

To connect to a running docker container and change files residing within the container you need to start an interactive session. First list all the running containers with the following command:

docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS         
08a9a1701107        rabbitmq:3.7.3-management   "docker-entrypoint.s…"   3 hours ago         Up About an hour

Docker will list all your running container as seen above. The column CONTAINER ID is important and we will be using this ID to connect to the interactive session of that container. To connect to the container enter the following command:

docker exec -it 08a9a1701107 su -

alternative for the CONTAINER ID is the container name if you happen to know this. In my case this would be:

docker exec -it rabbitmq-docker su -

What is docker!?

Posted: 8 August 2018 in Docker

Docker is a computer program that performs operating-system-level virtualization also known as containerization.[6] It was first released in 2013 and is developed by Docker, Inc.[7]

Docker is used to run software packages called “containers”. In a typical example use case, one container runs a web server and web application, while a second container runs a database server that is used by the web application. Containers are isolated from each other and bundle their own tools, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and are thus more lightweight than virtual machines. Containers are created from “images” that specify their precise contents. Images are often created by combining and modifying standard images downloaded from repositories.

Recently I was searching the internet for a good approach to perform database maintenance and index rebuilds on a scheduled basis. While searching for frameworks I found a nice project at https://ola.hallengren.com/ by Ola Hallengren.

A quote of the description from the authors page:

SQL Server Backup, Integrity Check, and Index and Statistics Maintenance

The SQL Server Maintenance Solution comprises scripts for running backups, integrity checks, and index and statistics maintenance on all editions of Microsoft SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, and SQL Server 2014. The solution is based on stored procedures, the sqlcmd utility, and SQL Server Agent jobs. I designed the solution for the most mission-critical environments, and it is used in many organizations around the world. The SQL Server Maintenance Solution has been voted as Best Free Tool in the 2013, 2012, 2011, and 2010 SQL Server Magazine Awards, and a top session at PASS Summit 2014. The SQL Server Maintenance Solution is free.

If you are looking for a method to perform easy database maintenance look no further and check out the provided page. This is a really nice set of scripts to put to good use in your own SQL environment! And in case you didn’t see that the description states it’s free this is your second chance at realizing this.

One of the nice features is that it contains a procedure to rebuild or reorganize indexes based on a fragmentation threshold.

All this indexation heaven is possible on a per-table-approach or even a complete database-at-once approach. Be aware to schedule this in your maintenance window time, otherwise this could slow down your server performance significantly when you start re-indexing large database tables in the middle of peak hours.

Tuna with Teriyaki Soy sauce

Posted: 7 May 2016 in BBQ

If you like roasted fish from the BBQ, I have a really easy and tasty recipe. Take a look at the picture of the result and decide for yourself if you want to give it a go.

BBQ_Tuna

BBQ Tuna in Teriyaki soy sauce marinade sprinkled with roasted sesame seeds.

What you need:
– Teriyaki sauce
– Soy sauce
– Roasted sesame seeds
– Tuna steaks (around 2/2,5cm thick and as fresh as possible)
– Temperature probe (i use a digital version, something like THIS.)
– Optional: wooden board for a smokey touch. Mine is Canadian western Red Cedar.
– A BBQ 🙂

Preparation:
If you are using a wooden board submerge the it in water for at least 45 to 60 minutes. It needs to be soaking wet when you put it on the BBQ.

Seasoning:
Seasoning dishes is not an exact science and you should always take this as a guideline not a strict rule. Play with the used ingredients until you have something to your own liking.

I mixed about 3 tablespoons of teriyaki sauce with 2 tablespoons of Soy sauce. Smear the mix on the first side of the tuna and sprinkle the roasted sesame seeds on the tuna. The teriyaki mix will glue the seeds to the tuna. Flip the tuna and repeat this with the other side. If you have leftover teriyaki mix keep this aside for later.

BBQ:
Heat up the BBQ with 2 zones. 1 Hot zone and 1 low heat zone. Put the wooden board on the hot zone to heat up. The side where the fish will be put on needs to be on the downside. After 2 to 3 minutes flip the board and move it to the border of the hot zone onto the low heat zone.

Put the tuna on the board and insert the probe into the middle of the tuna to monitor the temperature. Close the lid of the BBQ and wait until the core temperature of the tuna hits 50 degrees Celsius or even 46 degrees for very fresh Sashimi grade tuna. Sashimi grade tuna has been flash frozen to kill any parasites.

If you don’t use a wooden board sear the tuna for a couple of minutes on both sides. After that, move the tuna to the low heat zone and wait for the tuna to hit the desired temperature.

A couple degrees before the desired temperature is hit, sprinkle the rest of the teriyaki mix over the tuna for some extra flavor.

Enjoy! If you are going to try this give me some feedback on how you liked this.

FPV Mini quad racer

Posted: 7 June 2015 in Quadcopter
Tags: ,

A couple of weeks ago i had a walk in the park and ran into two guys who where flying mini quads on a field with a lot of tree’s and obstacles. I found it quite impressive and I could not resist the urge to have a talk with them to check out the hardware they where using. To make an impression of what they where doing check out the youtube movie they made with a Go-Pro on one of the quads: I take no credit for this insane flying. This is one of the guys i met at the park! I had the opportunity to watch his flying with a second pair of FPV glasses. This made me very enthusiastic to get started with FPV flying myself. And i ordered myself a 250 frame from Hobbyking.com.

DSCN1873

This is the unbuild frame with the motors and BESC. Below you will find a build report of the 250 mini-frame and the soldering of the BECS to the integrated circuit board.

DSCN1875

I am using Multistar brushless motors and 12a afro BECS for this project. This was a set bought together.

DSCN1879 DSCN1883

Al the frame parts in the kit and the integrated power distribution board where i will be soldering the ESC’s on. But lets start with building the frame to get an impression of the spots and spaces where all the electronics will be placed. The pictures are quite self explaining so enjoy the ride.

DSCN1885 DSCN1886

 

DSCN1882 DSCN1888 DSCN1890 DSCN1891 DSCN1892 DSCN1893 DSCN1894 DSCN1895 DSCN1896 DSCN1897 DSCN1898 DSCN1899 DSCN1900 DSCN1901 DSCN1902 DSCN1904 DSCN1903 DSCN1910 DSCN1914 DSCN1917

Soldering the ESC with short wires

Soldering the ESC with short wires onto the power distribution board.

DSCN1924 DSCN1929 DSCN1934 DSCN1935

Putting everything together with the esc’s soldered on. And ready to mount on the Naze32 flightcontroller, the receiver and the FPV circuit board.

DSCN1936

My first quad-copter!

Posted: 22 May 2015 in Quadcopter
Tags:

Last year i was getting interested in quad-copters and the potential of those cool flying things! Starting to read about them made me decide to try and build one myself. And i started to search the internet for parts and how-to’s to build them.

Back then the quad-copters weren’t that popular yet and self build quads where the way to go if you where capable of basic soldering and following tutorials that is. I also wanted to make my first build as cheap as possible. That in mind i started to browse Chinese websites for quad-copter parts and electronics. And i managed to gather all the vital parts:

  • X525 frame
  • A2212/13T 1000kv motors (4x)
  • 1 x KK board 5.0 (better get the KK 2.1.5 with LCD Display)
  • 30a speed controllers (4x)
  • 3300mah 3 cell battery
  • IMAX B6 50W 5A Charger/Discharger 1-6 Cells
  • HXT Simple Lipoly Monitor 2S~3S
  • Turnigy 9x transmitter and reciever
  • Propellers (1045 CCW 2x & CW 2x) (Counter clockwise & Clockwise)

 

X525 Frame, motors, BECS and flight controller all bought from dealextreme. As a starter kit this has good value for its money. I would also suggest to buy additional propellers and spare parts if you are new to this hobby. You probably will crash a lot at the beginning and its a hard wait for spares to arrive from china when you crashed the quad.

Turnigy 9x transmitter. This transmitter has lots of possibilities for the low price. It is flashable with another firmware which brings this transmitter to another level. After that it competes with transmitters in a price range at least 3 to 6 times the price you pay for this transmitter.

Quad1

This is the finished build of my quad copter. As you could see on this picture the KK multicopter 5.0 board is exchanged for a KK Multicopter 2.1.5 board which has a display on board an is directly tweakable from the board itself.  This makes changing PID controller values much easier and is one of the reasons i exchanged my first flight controller board with this new one. Unfortunately i did built this before i was in the blogging mode resulting in no pictures of the build itself.

Altogether the initial price tag on all this together is around 260 euros. After building and tweaking it do i still say its worth it? Definitely yes, the fun you will be having while building an own quad-copter against the out of the box experience with other of the shelve quads is much bigger. One of the advantages of a self made quad is that if something breaks you will know how to repair it because you have build it. And another cool thing is you will feel like macgyver while building it!