The requested image’s platform (linux/arm64) does not match the detected host platform

When I was testing Docker’s initial tutorial when you download for the first time I got the error:

The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64) and nospecific platform was requested.

It sucks because I got a new MacBook Pro M1 and I did not know about these issues with arm64 chips and images. Trying to play with the tutorial while having great coffee from Latin America I got stuck when trying to run the MySQL image in my compose file.

Searching around I found two options to resolve this. See below:

Option 1: Add the flag –platform linux/arm64

This will tell your MacOS M1 what platform to use. Brief example:

docker run -d \
    --platform linux/amd64 \
    --network todo-app --network-alias mysql \
    -v todo-mysql-data:/var/lib/mysql \
    -e MYSQL_ROOT_PASSWORD=secret \
    -e MYSQL_DATABASE=todos \
    mysql:5.7

Option 2: Use MariaDB instead of MySQL

As of this post MariaDB offers official support for ARM64 architecture. Use this docker command instead as an example:

docker run -d \
  -v todo-mysql-data:/var/lib/mysql \
  -e MYSQL_ROOT_PASSWORD=secret \
  -e MYSQL_DATABASE=todos \
  mariadb:10.5

MacOS Restarts and a Message Shows

The other day after having my favorite Latin America coffee I went to take a walk around Seaport in New York City. When I came back my Macos restarted with error message saying that my MacOS restarted and if I wanted to send a report to Apple. I pressed ignore and put on my new Code with Coffee T-Shirt.

The most likely cause is faulty software. A kernel panic can also be caused by damaged or incompatible hardware, including external devices attached to your Mac. If the kernel panic is caused by a known problem, the faulty software is identified. To make sure that this software doesn’t continue to cause kernel panics, move it to the Trash.

If not a faulty software and your MacOS continues to reboot with kernel panics, try these:

  1. Restart your Mac in safe mode. If it successfully starts up in safe mode, choose Apple menu > App Store, click Updates, then install any available updates.
  2. Uninstall any plug-ins or other enhancement software from manufacturers other than Apple. If you recently updated macOS or an app, plug-ins and other software that worked in the past may no longer be compatible. Read the manufacturer’s documentation (including Read Me notes) to be sure the software is compatible with your version of macOS.
  3. Disconnect all devices except for an Apple keyboard and mouse. Remove hardware upgrades from other manufacturers, such as random-access memory (RAM) and Peripheral Component Interconnect (PCI) cards. Then try restarting your Mac.
  4. If this resolves the issue, reconnect one device at a time, restarting your Mac after reconnecting each one, until you determine which device is causing the problem.
  5. Use Apple Diagnostics to diagnose problems with your computer’s internal hardware, such as the logic board, memory, and wireless components.

You can also check MacOS Console to find out more details about why your MacOS restarted.

Find Public IP Address using Linux Command Line

The other day I had to ssh into a RedHat Linux server to help a friend. My friend wanted to find the public IP address using Linux command line. This is simpler than what I imaged.

After having one of my favorite Latin America coffee from Peru I was able to find the answer. Use these simple commands after opening your Terminal/Command line on Linux:

  • Using the dig command type:
    • dig +short myip.opendns.com @resolver1.opendns.com
  • or you can use this one:
    • dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

You can now see your public IP address on your Linux terminal.

Find Public IP Address using Linux
Find Public IP Address using Linux

Create Desktop Shortcut Windows 10 For All Users

The other day a friend asked me to create a desktop shortcut in Windows 10 for all users. I have been using other operating systems for a while and have been trying to stay away from Windows.

After taking a walk in New York City I refreshed my mind and found a way to create this desktop shortcut for all users in Windows 10. These are the steps:

  • Login as Administrator in Windows 10 (Your local Admin account)
  • Go to your C drive > Users > Public > Public Desktop (“Public Desktop” is usually a hidden file, so you need to do this – in your File Explorer select ‘View’ and then select the checkbox ‘Hidden Items’
desktop shortcut Windows 10
Show hidden files Windows 10

Now just drag and drop your shortcuts into the Public Desktop and it will show for all your users in Windows 10.

Find Shutdown Log Windows 10

The other day while working at a client’s office I had to deploy an application update using a Thin Client management console. I pushed the update to all Thin Clients. Shutdown Log Windows 10

This was supposed to be a non-intrusive deployment of the application – meaning the Thin Clients were not supposed to reboot. One Thin Client rebooted and I needed to find out why.

In Windows 10 there are three events that gives you information about reboots and shutdown:

Event ID 1074 – Indicates that the shut down process was initiated by an app. For example, it can be Windows Update.

Event ID 6006 – The clean shut down event. This means Windows 10 was turned off correctly.

Event ID 6008 – Indicates a dirty/improper shutdown. Appears in the log when the previous shutdown was unexpected, e.g. due to power loss or etc.

To find these events simply do:

  • Press Windows key + R one the keyboard to open the Run dialog and then type eventvwr.msc followed by enter.
  • In Event Viewer, select Windows Logs and then System on the left.
  • On the right, click on the link Filter Current Log.
  • In the next dialog, type the line 1074, 6006, 6008 into the text box under Includes/Excludes Event IDs.
  • Click OK to filter the event log.

Now, the Event Viewer will display only events related to shut down and you can investigate reasons why. Hope this Find Shutdown Log Windows 10 brief tutorial helps.

Now, go see my sister website NYC Moments to see inspirational pictures of New York City.

How to Generate SSH Key Pair in Linux

The other day I got a new laptop and needed to generate ssh key pair. Sometimes you forget basic commands when you don’t run them on a daily basis. So, I took a short walk in Brooklyn, New York City before I started working on my new laptop setup.

To generate ssh key pair in Linux is quite simple. Use the ssh-keygen command. Open your Terminal and type:

ssh-keygen -t rsa

Next, you will need to specify the location of the file where you want to save the key such as for example:

Enter file in which to save the key (/home/youruser/.ssh/id_rsa):

Don’t type anything to leave your key at the default location with the default name /home/youruser/.ssh/id_rsa. If you want to you can specify a different name. I do this when I need to ssh to different servers, this helps me keep organized.

Finally, you will need to type a password if you like:

Enter passphrase (empty for no passphrase):

I usually leave it empty, but this is really up to you.

This will create a private key written to: /home/youruser/.ssh/id_rsa 

and a public key written /home/youruser/.ssh/id_rsa.pub

Copy the contents of your .pub file into your server’s .ssh/authorized_keys

You need to change your Linux permissions to:

chmod 700 .ssh/ 
chmod 600 .ssh/authorized_keys

Now you should be able to SSH to your server without using a password. Give it a try and Contact me if you have any questions.

Change Default Shell to bash macOS Big Sur

The other day I got a new Apple M1 processor chip (I really don’t like there’s only two ‘USB-4’ ports and the ‘Magic bar’ bothers me!). But, anyways when I opened my terminal i noticed the below message and wanted to change default shell to bash for this macOS Bir Sur.

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.

I got used to bash on my nice old friend macOS High Sierra. So, I found a way to change default shell to bash for it. Before changing this I brewed one of my favorite Latin America coffees from Honduras.

How Change Default Shell to bash macOS Big

This is very easy to do:

  1. Open your terminal
  2. List available shells by typing: cat /etc/shells
  3. To change your account to use bash type: chsh -s /bin/bash
  4. Close your terminal
  5. Open your terminal and verify that bash is your default shell running: echo "$SHELL" or printf "%s\n" "$SHELL"
  6. You should see the following output: /bin/bash

Find out your current bash version

Simple, type this command in your terminal:

bash --version

Hope this quick tutorial was helpful. See my other quick tips on Docker.

Python’s built-in HTTP server handy one

While building my own Flask application for learning purposes. I was not sure how it was being served on the web. I did not install Apache of any other web server, but it is running on my Digital Ocean test server. The I found out about Python’s built-in HTTP server.

This final purpose of this app is to keep track of your blood pressure at home. I will keep you posted about the progress. You can also see my Github repo and offer any suggestions if you like.

Anyways, after having a great cup of Latin America coffee I discovered that Python has an standard HTTP server built into the standard library. So, when I run my CMD python run.py at the end of my Dockerfile it starts the Python standard HTTP build-in server for me.

If you like to run it alone for other testing purposes you can do the below.

For Python 3.x:

python3 -m http.server

For Python 2.x

python -m SimpleHTTPServer 8000

This will serve the current directory at your http://localhost:8000 or http://127.0.0.1:8000

Python’s built-in HTTP server is a useful standard library that I was not aware or did not occur to think about it until today. Don’t know why.

I invite you to check my other posts about setting up Ubuntu server static IP. Thanks and let me know if you have any questions.

How to Check Linux OS version Command Line

While having a great Latin America coffee from Ecuador I came to realize that I did not remember how to check Linux OS version using the command line.

Below are some examples for finding your Linux OS version. Open your command line:

/etc/os-release file

Type the following command using cat in Debian based distros:

cat /etc/os-release

I got the below result in my terminal:

Check Linux OS version Command Debian

/proc/version file

Using cat /proc/version worked for me for both Debian and Red Hat distros. Simply run:

cat /proc/version

And you should get the below result:

Linux version 4.4.0-198-generic (buildd@lgw01-amd64-051) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) )

Other commands to find Linux OS version

Try running in your terminal the below commands and experiment to see what output you get. If your Linux distro does not support it you should get a “command not found” error.

cat /etc/issue
hostnamectl
uname -a
lsb_release -a (mainly for Debian distros)

Basic Linux Commands for Newbies

The other day one of my friends who is a Windows user asked me to basic Linux commands because he wanted to improve his IT skills. I helped him out and also decided to put together a brief list of basic Linux commands for newbies while having fantastic Latin America coffee at home.

Basic Linux Files and Navigation Commands

CommandDescription
lsList of files/directories in current directory
ls -lFormatted listing
ls -laFormatted listing including hidden files
cd <dir>Change directory to <dir>(<dir> is directory name)
cdGo to your home directory
pwdShow current path
mkdirMake a directory e.g. mkdir holadir
rmRemove a file e.g. rm myfile
rm -rDelete a directory e.g. rm -r mydirectory
cpCopy files e.g. cp myfile yourfile
mvRename files e.g. mv myfile yourfile
Files and Navigation Linux Commands

Networking Basic Linux

CommandDescription
pingPing a host
whoisGet whois for a domain
digGet DNS for a domain
wgetDownload a file
wget -r <url>Recursively download files from url
curl <url>Output webpages from url
ssh user@hostConnect to host as user
ssh -p <port> user@hostConnect to host as user using a port
ssh -D user@hostConnect and use bind port
Basic Networking Linux Commands
Continue reading “Basic Linux Commands for Newbies”