Skip to content

shailensukul/docker-certification

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Sections

Section
01 Orchestration
02 Image Creation, Management and Registry
03 Installation and Configuration
04 Networking
05 Security
06 Storage and Volumes

Docker Certified Associate

Docker Certified Associate

My notes while preparing for the Docker Certified Associate exam.

Links
Official Pdf Guide
Official Prep Guide
Markdown Cheatsheet
Study guide
Another study guide
Another another study guide
Terminal Recorder
Paste to Markdown

Basics

An image is a lightweight, stand-alone, executable package that includes everything needed to run a piece of software, including the code, a runtime, libraries, environment variables, and config files.

A container is a runtime instance of an image—what the image becomes in memory when actually executed. It runs completely isolated from the host environment by default, only accessing host files and ports if configured to do so.

VS Code on Headless Pi

Edit files on Pi from PC

Troubleshooting

  • When getting EACCESS permission denied, saving files with Visual Studio Code on host
sudo chown -vhR dockeradmin /home/dockeradmin
  • SSH from VSCode is repeatedly failing:

Enable root login on the pi so you can run commands without sudo

Login, and edit this file: sudo nano /etc/ssh/sshd_config Find this line: PermitRootLogin without-password Edit: PermitRootLogin yes Close and save file reboot or restart sshd service using: /etc/init.d/ssh restart Set a root password if there isn't one already: sudo passwd root

For this message when service starts:

NanoCPUs can not be set, as your kernel does not support CPU cfs period/quota or the cgroup is not mounted

This is because you cannot control cpu limits on a Pi. Remvove this from the docker compose file:

      resources:
        limits:
          cpus: "0.1"
          memory: 50M

Ref: microsoft/vscode#48659 C:\Users\shail.vscode\extensions\ms-vscode-remote.remote-ssh-0.50.1\out

I did some more experimenting and I've found a way that works. -o RemoteCommand=none is not the only thing in this extension that prevents VS Code from establishing a working ssh session after calling sudo -u newuser -i, we also need to remove bash so that VS Code does not start an additional shell session on the remote host.

Here's a HOWTO:

make sure that sudo -u newuser -i works in a regular ssh session without requesting a password remove "-o RemoteCommand=none" and "bash" from extension.js like so sed -i s/"-o RemoteCommand=none"/""/ ~/.vscode/extensions/ms-vscode-remote.remote-ssh-/out/extension.js sed -i s/"bash"/""/ ~/.vscode/extensions/ms-vscode-remote.remote-ssh-/out/extension.js

JQ

JQ is a great tool for filtering through JSON output.

For example:

docker service inspect mystack_web | jq -r '.[].CreatedAt'

Here is how to install it on the Raspberry Pi

cd /tmp
wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-1.5.tar.gz
tar xfvz jq-1.5.tar.gz
cd jq-1.5
./configure && make && sudo make install

Digital Ocean

  • Sign up for a free trial account at (Digital Ocean)[https://cloud.digitalocean.com]
  • Create a Ubuntu droplet
  • You will get an email with the IP address of the droplet and the root user & temporary password. SSH into the droplet and change the root user password when prompted
ssh root@[droplet ip]
  • Create another user for docker and give it sudo privileges
adduser dockeradmin
usermod -aG sudo dockeradmin
logout
  • Now, you can SSH as the docker admin user
ssh dockeradmin@206.189.82.62
  • Install docker by running this script
 wget -O - https://raw.githubusercontent.com/shailensukul/docker-certification/master/Scripts/install-docker.sh | bash

asciicast

Terminal Recording

Install with:

sudo apt-add-repository ppa:zanchey/asciinema
sudo apt-get update
sudo apt-get install asciinema

Record:

asciinema rec

Stop recording:

To finish hit Ctrl-D or type exit.

About

Prep for passing my Docker Certified Associate Exam

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published