The repository contains the code needed to build a container to support the work of developers. It includes the necessary libraries and tools. Image has built-in access to the docker engine of the machine on which it will be built/run.
git clone git@gitlab.syncad.com:hive/builder-image.git
cd builder-image- copy your public key to authorized_keys file
- in the file run_image.sh
- container name ( --name haf-builder )
- mapping folder ( -v /storage1/data:/workspace )
- ssh port ( -p 2023:22 )
- in file .gitconfig (your name, e-mail and git alias preferences)
- if file .bash_aliases (your favourite bash aliases)
./build_image.sh./run_image.shOnce the container is running, you can access it by running the command
CONTAINER_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haf-builder)
ssh haf_admin@${CONTAINER_IP}You can use a plugin for VSC called Remote - SSH to connect to the container.
When you run the container for the first time, it creates a folder named .vscode-server in /workspace and links it symbolically to your home directory (/home/haf-admin/.vscode-server) - this allows you to keep installed plugins and settings in case the container crashes. On restart or reboot, the container will recognize that it already has such a folder and use its contents. Do not delete it unless you know what you are doing ;)
Access is best configured using the ~/.ssh/config file example content below
Host container
HostName 172.16.0.12
User haf_admin
Port 2023
IdentityFile ~/.ssh/id_rsaConnecting from within VSC - press Ctrl-Shift-p and type remote ssh, select option Remote SSH: Connect to host... and choice your previously defined connection(container).
SSHFS (SSH File System) is a client for mounting a file system located on a remote machine onto your local system through an SSH connection. This option will be useful for users of PyCharm's free version, as it does not have the ability to edit through an SSH connection like VSC. VSC users can also use this method instead of the plugin mentioned above.
sudo apt update
sudo apt install sshfs
sudo vim /etc/fuse.conf (uncomment this option -> #user_allow_other)
mkdir ~/extrernal
sshfs -o uid=$UID,gid=$GROUPS,allow_other,default_permissions container:/workspace/ ~/external/or
sshfs -o uid=$UID,gid=$GROUPS,allow_other,default_permissions,IdentityFile=~/.ssh/id_rsa haf_admin@172.16.0.12:/workspace/ ~/external/
Where: container is predefined in ~/.ssh/config connection
From now on, you can use sshfs to access a submapped resource provided by a container just like a local file system.