Using Remote Docker Containers in Visual Studio Code

Using Remote Docker Containers in Visual Studio Code

You need ssh access on remote server via authorized_keys

Setup SSH Access if Required

Get your public key

cat ~/.ssh/id_rsa.pub

Logon to your target server and install your public key

cat >> ~/.ssh/authorized_keys

Make sure authorized_keys has proper permission; otherwise it won't work

chmod 600 ~/.ssh/authorized_keys

Visual Studio Code Setup

Prerequisites

  • Docker machine installed on remote server
  • Visual Studio Code installed on local machine
  • Docker plug-in installed on Visual Studio Code
  • Remote - Containers plug-in installed on Visual Studio Code

You will need to create a Docker Context

Refer: https://stackoverflow.com/questions/60425053/vs-code-connect-a-docker-container-in-a-remote-server

Here's an example of one

docker context create macbook-parallels --docker "host=ssh://mruckman@192.168.86.34"

Now you need to use this context, any Docker command you run, will be against that remote server, once context is used

docker context use macbook-parallels

Now launch Visual Studio Code, you will see your remote container and images now. Launch your desired remote container, and you can now attach to it.

If you want to revert back to your local Docker context

docker context use default

Other helpful context commands

List all of your contexts

docker ls

Remove a context

docker rm context-to-remove

Change Linux Kernel Being Used

Refer: https://linuxhint.com/update_ubuntu_kernel_20_04/

Article originall written for Ubuntu 20.04 but used it with Ubuntu 18.04 to fix Parallels issue with slow startup

In order to downgrade to an earlier kernel you will need to make sure you can see the Grub boot screen and change things.

Refer: https://askubuntu.com/questions/82140/how-can-i-boot-with-an-older-kernel-version

At the time of this writing: 5.4.144 seems to work for Ubuntu 18.04
Base install of Ubuntu 20.04 used 5.8.0.63.71 and it seemed fine but upgrade to 5.11.0.36.40 seemed to slow bootup

5.8.18 works as of 2021-09-23, Parallels Tools do NOT seem to work with latest versions of kernel

Force remove, Seems Like Parallels is NOT ready for the new Kernels

Refer: https://askubuntu.com/questions/1253247/how-to-fix-or-remove-a-broken-kernel-ubuntu-20-04

cd /boot

Remove faulty links

sudo rm vmlinuz
sudo rm vmlinuz.old

Remove Faulty Kernel Example

sudo rm vmlinuz-5.7.5

Relink Correctly Example

sudo ln -s vmlinuz-5.4.0-37-generic vmlinuz
sudo ln -s vmlinuz-5.4.0-26-generic vmlinuz.old

Looking for Bad Stuff with 5.11 as Example

ll *5.11*

Final Cleanup to Take Changes

sudo update-grub
sudo apt update
sudo apt upgrade
sudo reboot now

Original Setup Starts Here

sudo gedit /etc/default/grub

change GRUB_TIMEOUT to -1 and comment out GRUB_HIDDEN_TIMEOUT

### GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=-1

Make sure you can see messages instead of splash screen

### GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
### GRUB_CMDLINE_LINUX_DEFAULT="noresume"
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
sudo update-grub

Check your current version

uname -r

Install a GUI call "mainline" to install another kernel

sudo apt-add-repository -y ppa:cappelikan/ppa
sudo apt update
sudo apt install mainline

Select "mainline" from applications, and choose your kernel

After you download and build, you need to reboot

reboot

Check your new version

uname –r

Ubuntu Startup Messages and NOT Splash Screen

Refer: https://askubuntu.com/questions/1030867/how-to-diagnose-fix-very-slow-boot-on-ubuntu-18-04

To update GRUB so that it passes this option to the kernel automatically on boot:

Edit the file /etc/default/grub file so that the string noresume is included in the GRUB_CMDLINE_LINUX_DEFAULT line, for example:

sudo gedit /etc/default/grub
### GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT=""

or if you want to ignore the SWAP file

GRUB_CMDLINE_LINUX_DEFAULT="noresume"
sudo update-grub

Mute Everything (ALL)

# MUTE EVERYTHING ON UBUNTU
# REFER: https://askubuntu.com/questions/12100/command-to-mute-and-unmute-a-microphone

pacmd list-sources | \
    grep -oP 'index: \d?\d' | \
    awk '{ print $2 }' | \
    xargs -I{} pactl set-source-mute {} toggle

Backup / Restore Firefox Settings

Refer: https://support.mozilla.org/en-US/kb/back-and-restore-information-firefox-profiles

Source Computer

In Firefox click the pancake setting and go to Help, "More troubleshooting information"

Look for path to your "Profile Directory", such as:
/home/mruckman/.mozilla/firefox/6kzldk99.default-release

Close Firefox

Zip/Tar the entire folder

Target Computer

Same procedure as above, locate the folder of your profile. Erase everything in the folder and replace it with the source folder information, the contents remain the same, the only change is the folder name.

Make sure to CLOSE Firefox before deleting and copying the files

Getting WiFi to Work on MacBook Pro Mid 2014

Getting WiFi to Work on MacBook Pro Mid 2014

Note: You MUST have an Internet connection already established to run this

Refer: https://askubuntu.com/questions/748951/wi-fi-not-working-on-mid-2014-macbook-pro-with-ubuntu-15-10

sudo apt-get update
sudo apt-get --reinstall install bcmwl-kernel-source
sudo modprobe -r b43 ssb wl brcmfmac brcmsmac bcma
sudo modprobe wl

After shutdown, you will need to run the following two commands again

sudo modprobe -r b43 ssb wl brcmfmac brcmsmac bcma
sudo modprobe wl

Tar Zip Files

Extract just a Tar file

tar -xvf yourfile.tar

Compress Files

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

Extract Files Current Folder

tar -xzvf name-of-archive.tar.gz

Extract Files to Specific Location

Target Location Must Exist

mkdir /tmp/Documents
tar -xzvf name-of-archive.tar.gz -C /tmp/Documents

Split Files Into Pieces

Refer: https://askubuntu.com/questions/54579/how-to-split-larger-files-into-smaller-parts

mkdir output
split --bytes=10M aem-6.4-authoring.tar.gz output/prefixeS

Combine the Pieces

cat prefixeS* > aem-6.4-authoring.tar.gz

Sharing Ubuntu Image

split --bytes=1000M Ubuntu1804-AEM-64GB.ova output/prefixeS
cat prefixeS* > Ubuntu1804-AEM-64GB.ova

Remove Z to NOT do compression, this includes FULL path in tar file

tar -cvf firefox-profile.tar.gz /home/mruckman/.mozilla/firefox/7sqqgk5s.default-release-1/