Connect X86 to Raspberry. SSH. VNC. Docker. Debian . Raspbian .02
user1272047
3 min read
Docker and VNC Setup
https://programmingetc.hashnode.dev/connect-x86-to-raspberry-ssh-vnc-docker-debian-raspbian
Docker Repository Overview
Repository Details
Repository: user987987/debian.raspberry.5.64b.vnc.xfce.2024.10.25.02
[arm/raspberry5. docker. debian12]
Credentials:
OS: user root; pass: 1234;
VNC: root 123456; Port: 5901
Credentials
raspberry users password
user001 1234
root 1234
debian/arm users password
user001 1234
root 1234
vnc users password
root 123456
Docker Pull Command
docker pull user987987/debian.raspberry.5.64b.vnc.xfce.2024.10.25.02:2024025
Port Mapping
PORT_MAPPING=""
for i in $(seq 140 140); do PORT_MAPPING+=" -p $i:$i"; done
for i in $(seq 3500 3600); do PORT_MAPPING+=" -p $i:$i"; done
for i in $(seq 5900 6000); do PORT_MAPPING+=" -p $i:$i"; done
for i in $(seq 8400 8500); do PORT_MAPPING+=" -p $i:$i"; done
Docker Commands
Block 1 - Main
# Set image and container names
imagename=debian:latest
imagename=debian.raspberry.5.64b.vnc.xfce.2024.10.25.01
containername=debian.raspberry.5.64b.vnc.xfce.2024.10.25.01.01.dkr.ctr
Remove any existing container with the same name
docker rm -f $containername
sleep 4
mkdir -p /media/shareddir
docker run --name $containername -d -it --privileged --volume "/media/shareddir:/media/shareddir:rw" $PORT_MAPPING $imagename bash
Enter the Docker container
docker exec -it $containername /bin/bash
Block 2 - Alternative
# Set image and container names
imagename=debian:latest
imagename=debian.raspberry.5.64b.vnc.xfce.2024.10.25.02.user.root.passw.1234.vnc.passw.123456.img.dck
containername=debian.raspberry.5.64b.vnc.xfce.2024.10.25.01.01.dkr.ctr
#Start
docker start $containername
Enter the Docker container
docker exec -it $containername /bin/bash
Block 3 - VNC
#docker . vnc
rm -f /tmp/.X1-lock /tmp/.X11-unix/X1
vncserver :1
New 'X' desktop is 8e4039091e66:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/8e4039091e66:1.log
root@8e4039091e66:/#
Block 4 - Commit
docker commit 8e4039091e66 debian.raspberry.5.64b.vnc.xfce.2024.10.25.02.user.root.passw.1234.vnc.passw.123456.img.dck
Block 5 - Backup
#dockerbackup #dockerbkp #dockerbackup #dockercommit #start point
#host superuser
#sudo su
List every container id
docker ps -a
Get container id from a particular container name
containername='debian.raspberry.5.64b.vnc.xfce.2024.10.25.01'
imagename=debian.raspberry.5.64b.vnc.xfce.2024.10.25.02.user.root.passw.1234.vnc.passw.123456.img.dck
id=$(docker ps -aqf "name=$containername")
echo $id
dir_bkp=/media/ubuntu/shareddir1/0_bkp/
mkdir $dir_bkp
cd $dir_bkp
#rm *.tar #rm *.tar.gz
note='bkp.2024.10.25'
date1=$(date)
echo 'dockerstop'
echo ''
docker stop $containername
echo "dockercommit $containername $imagename"
echo ''
docker commit -p $id $imagename
cd $dir_bkp
echo "dockersave $imagename"
echo "$imagename"."$note".tar
echo ''
docker save -o "$imagename"."$note".tar $imagename
echo "compress gz $imagename"
echo ''
apt update
sleep 3
apt install pv -y
pv "$imagename"."$note".tar | gzip -9 -v > "$imagename"."$note".tar.gz
echo $date1
ls $dir_bkp
echo ''
ls $dir_bkp/"$imagename"."$note"*
Block 6 - VNC Server
export USER=root
rm -f /tmp/.X1-lock /tmp/.X11-unix/X1
export USER=root
vncserver :1
ps aux | grep Xtightvnc
netstat -tuln | grep 5901
VNCserver output
root@raspberrypi: ps aux | grep Xtightvnc
root 16807 0.3 0.4 53812 19144 ? S 21:11 0:23 Xtightvnc :1 -desktop X -auth /root/.Xauthority -geometry 1024x768 -depth 24 -rfbwait 120000 -rfbauth /root/.vnc/passwd -rfbport 5901
-fp /usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/ -co /etc/X11/rgb
root 25619 0.0 0.0 7520 1792 pts/0 S+ 22:53 0:00 grep Xtightvnc
root@raspberrypi: netstat -tuln | grep 5901
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN
tcp6 0 0 :::5901 :::* LISTEN
root@raspberrypi:
VNC Client Connection
Username: root
IP:Port: 192.168.0.103:5901
Password: 123456
Block 7 - Push Image to Docker Hub
root@raspberrypi:~# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: $Username_dockerhub_io
Password: $digit_Password_dockerhub_io
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
root@raspberrypi:~# docker tag debian.raspberry.5.64b.vnc.xfce.2024.10.25.02.user.root.passw.1234.vnc.passw.123456.img.dck user987987/debian.raspberry.5.64b.vnc.xfce.2024.10.25.02:20241025
root@raspberrypi:~# docker push user987987/debian.raspberry.5.64b.vnc.xfce.2024.10.25.02:20241025
The push refers to repository [docker.io/user987987/debian.raspberry.5.64b.vnc.xfce.2024.10.25.02]
9a749df0587b: Pushed
1fffd951522e: Pushed
5968baa45665: Mounted from library/debian
20241025: digest: sha256:067421e8d793a4d6087cc004f773cfa0302461d73a934d11aec55d4926f46ac7 size: 956
root@raspberrypi:~#
| | | --- |
0
Subscribe to my newsletter
Read articles from user1272047 directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by