This guide has been setup for Raspberry Pi 3B+ with NOOBS pre-installed. V1 written 2019-04-07. The github repo: https://github.com/Neylion/raspberry-pi
- Assemble the Raspberry pi and insert the SD card with NOOBS on it.
- Connect a keyboard, mouse and screen to the RPI.
- Do not connect it to the internet yet.
- Connect the Raspberry Pi to the power source (Raspbian will automatically be installed).
If you later want to start over, this is how you make a “factory reset”:
- Restart the machine (power off/on or
sudo reboot
) - During bootup, repeatedly press shift (If you succeeds Noobs menu will be loaded, if you fail the raspberry will boot like normal and you can start over at #1).
- Choose Raspbian.
- Click install
- Enter the menu -> Preferences/Raspberry Pi Configuration.
- Go to the tab “Localisation”.
- Change to the appropriate keyboard layout.
- Change to the appropriate WiFi Country.
- Go to the tab “System”.
- Change Password.
- Go to the tab “Localisation”.
- Connect to a wifi in top right corner.
- Open up a terminal
- Use the command
sudo raspi-config
. - Enable VNC (Navigate using arrows & enter)
- Choose Interfacing Options
- Choose VNC
- Choose
- Find the IP for the raspberry pi by using the command
hostname -I
- Download VNC Viewer on your computer.
- Open VNC Viewer
- Enter your raspberry pi IP.
- Enter your raspberry pi user credentials.
- Follow this guide to avoid having to authenticate yourself for every git action
- Open up a terminal
- sh git-init.sh > git-init.log
- sh clone-raspberry-pi-repo.sh > clone-raspberry-pi-repo.log
curl -fsSL https://get.docker.com | sh | tee get-docker.log
WARNING: Adding a user to the "docker" group will grant the ability to run containers which can be used to obtain root privileges on the docker host.
- sudo usermod -aG docker pi
- Logout and login to take effect
- docker --version | tee docker-version.log
- docker info | tee docker-info.log
- docker run hello-world
- Verify that a (long) hello message is displayed
This description is based on docs.docker.com
NOTE: These instructions should be done a separate machine with the following requirements:
- Windows 10 pro (required for docker)
- Docker installed
- Visual Studio IDE
- Create a .net core "Hello world!" project.
- Right click the project and choose "Add/Container Orchestrator Support".
- Choose Docker as container orchestrator in the popup.
- Choose Linux in the popup.
- Docker file adjustments (TO BE EXPANDED ON!)
- To add support to run in linux environment make sure the first line is
FROM microsoft/dotnet:2.2-runtime-stretch-slim-arm32v7 AS base
- To add support to run in linux environment make sure the first line is
- Save the project.
- Open a terminal.
- Run the command
docker build <path_to_docker_file> --tag="<image_name>:<image_tag>"
- Login to docker hub using
docker login
and following the instructions - Run the command
docker push <image_name>:<image_tag>
Now the image you created is available on dockerhub and anyone (?) can download and run it.
- Open the a terminal on the rasberry.
- Enter the command
docker run <image_name>:<image_tag>
- Go to "Control Panel/System and Security/System and click "Advanced system settings" on the left
- Click the "Environment Variables..." button on the popup window.
- Click add in the user section and enter your variable name and value.
- Click "OK" on all the popup windows related to this action.
- You are now done but need to run a restart to make the variables available for use.
Pre-requisite: For these steps "vim" is used as text editor. You can install it using the command sudo apt-get install vim
.
- Open up a terminal.
- Enter the command
sudo vim /etc/profile
. - Click the "i"-key to enter insert mode.
- At the bottom of the file, enter "export <VARIABLE_NAME>="<VARIABLE_VALUE>" (You can repeat this on multiple rows to add multiple variables).
- Press the "esc"-key and write
:wq
to save the file. - You are now done but need to run a restart to make the variables available for use.
- (OPTIONAL) You can confirm that the environment variable has been created properly by going to a terminal and using the command
printenv <VARIABLE_NAME>
.
- Go to the code location where you want to use the variable value.
- Use Environment.GetEnvironmentVariable("<VARIABLE_NAME>").
To be able to fetch the variables from a docker container we must pass them in when running the image. This can be done in a number of ways but for these steps the "--env-file"-option is used.
- Open a terminal.
- Create the env.list file.
- Use the command
cd
. - Use the command
sudo vim Documents/env.list
- Enter the variable names (one per row) that you want to be able to use in the container.
- Use the command
- Run the image but add
--env-file env.list
before the image name&tag.docker run --env-file env.list <image_name>:<image_tag>