Export your Docker images and run them remotely

I am assuming you already have a docker image that you now want to move to another host. In this example I have two web server containers I want to move called web1 and web2.

list docker images
docker image ls

Now we can to export image web1 to a file. This is simple using docker
save -o web1.image
However, if we pipe the output to bzip2 we can reduce the size of this image significantly.
In the image below you can see I have gone from 125mb to 42mb in size.
docker save web1 | bzip2 > web1.image.bz2
not a bad reduction especially if you are moving larger images over smaller pipes.

docker save
docker save <image> -o <exported-image>

Now you can scp the file to the remote host and then load the image into your remote docker instance. Docker supports compressed files so you don’t have to extract the bz image file.
docker load < web1.image.bz2
Next simply run your image. In this example I giving the container a name “web1”, running it in daemon mode on port 8081 which connects to port 80 on the actual container. The last web1 argument is the name of the image file.
docker run --name web1 -d -p 8081:80 web1

docker load image
A quick screenshot of what the process might look like.

Now that you see the steps we can condense these into one command which hopefully looks less like magic now and more like a neat shortcut.
docker save web2 | bzip2 | ssh user@remotehost 'bunzip2 | docker load; docker run -d -p 8082:80 web2

unable to launch go app, github.com/gorilla/mux

Wanting to test out a sample API app from swagger.io using golang on CentOS7 and found the simple start not so simple. The short answer is that is required git to pull the required packages from github to compile the program.

This host was a fairly new CentOS7 host with very few installed packages. I wanted to work with the pets api sample from swagger.io using golang. But as you can see below it failed to launch.

unable to find package for gorilla/mux.
trying to install gorilla/mux directly.

So I tried to install gorilla/mux directly and noticed that it was not able to pull the package from github. This made me wonder if I had git installed, I did not. Simple solution simple fix?

sudo yum install git -y

Yes, simple fix, after that it was really simple again.

Screen time controls not working

This week it seemed like the screen time controls I had in place were not working as expected. The phone I provided to my son was supposed to limit his screen time to about 2.5 hours a day but it sure felt like he had gone over that limit.

I checked went to check what sort of time reporting I had for his phone and noticed that it seemed to show very little detail, in fact, it seemed to have stopped reporting anything in the past week.

I could see this by going to Settings -> Screen Time -> selecting his name and looking under the daily average. It showed the last update date as a week prior and a small circle was spinning as if to tell me it was trying to update.

The solution was to toggle the “Ask to Buy” option found under Settings -> My name (top of the screen) -> Family Sharing -> His name (under Family Members) -> Ask To Buy. Here disable the option, go back once, return and re-enable the option. Once enabled his phone immediately got a message saying that Screen time was enabled. I also saw an update on for his screen time usage. As expected on a few days it had gone past the 2.5-hour limit. Now that it is enabled we will see how well it works.

Family sharing disabled apple Face ID setup

I have recently provided my son with an iPhone and in the process enabled some of the typical parental controls. In addition during the setup, I skipped over the Face ID setup assuming it would be simple to complete later and it should be his face and not mine used for this feature.

FaceID & Passcode
Where did it go?

Anyway, later when trying to find the Face ID option it appeared to be missing. I could find the section for Face ID but nothing about setup or resetting this feature. The issue is based on if you allow your child the ability “Passcode Changes”. When this feature is disabled the menu item on your child’s phone for “FaceID and Passcode” will be removed.

So, on your phone go to Settings -> Screen Time -> Content & Privacy Restrictions -> Passcode Changes. Here select either Allow (FaceID and Passcode will show) or Don’t Allow (FaceID and Passcode will NOT show).

It is also worth noting that you can now have more than one FaceID assigned to the phone. So, I could have set up FaceID with my image to start with but I still would have had this issue later when he tried to add his own image to FaceID.

Firewall-cmd cheat sheet

As I find myself infrequently changing firewall rules I often have to look up the syntax again and these tips cover 90% of what I want to do.

Get zone details; here is a quick reminder on how to find the default zone, find the active zone and finally list all the current rules.

firewall-cmd --get-default-zone
firewall-cmd --get-active-zone
firewall-cmd --list-all

Adding rules for https traffic

firewall-cmd --get-default-zone
firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd --reload
firewall-cmd --zone=public --list-all

Adding rules for port 53 tcp

firewall-cmd --get-default-zone
firewall-cmd --zone=public --permanent --add-port=53/tcp
firewall-cmd --reload
firewall-cmd --zone=public --list-all

tail me some less…

One of my favorite tricks when using less is the ability to switch to a data stream in a log file or any file that might have dynamic content being added

  1. Typically I open the file in question using less then, review as required.
    here you use your standard Vi related navigation tricks.
  2. Move to the bottom of the file using SHIFT + g
  3. Switch to data stream mode using SHIFT + f
  4. Once you want to exit from the data stream use CTRL + c to quit
  5. Return to navigating around the file using the Vi style commands
  6. Finally exit the file
  7. Ask yourself if you will need tail -f much longer…

Stop Network Manager overwriting resolv.conf

Arg.. I updated /etc/resolv.conf and later after a reboot or restarting my network services NetworkManager pulls out my updates. So to stop this here is what have found works for me.

  1. Update /etc/resolv.conf as I wish
  2. edit NewtworkManager.conf
    sudo vi /etc/NetworkManager/NetworkManager.conf
  3. add dns=none under [main]
  4. restart NetworkManager to ensure my /etc/resolv.conf is left alone
  5. Wonder why I didn’t sort this out sooner 🙂