Skip to content

Commit 68f309c

Browse files
committed
added build script
1 parent 916d4e8 commit 68f309c

File tree

3 files changed

+68
-22
lines changed

3 files changed

+68
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.deb

README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,49 @@
11
# Container for Cisco Packet Tracer 8.2.1 with Podman
22

3-
This is my personal repos to build Packet Tracer container on Fedora (running Xorg not Wayland).
3+
This is my personal repos to build Packet Tracer container on Fedora (running **Xorg** not Wayland).
44

55
- Packet Tracer is only supported on Ubuntu so I'm building a Ubuntu container with Podman.
66
- Packet Tracer has a mandatory login process (skillsforall.com) so I added firefox.
77
- Also added a missing qt5 lib for version **8.2.1**.
88

99
Install the application with [Podman](https://docs.fedoraproject.org/en-US/neurofedora/containers/):
1010

11-
# Download Ubuntu package from [skillsforall.com](https://skillsforall.com/resources/lab-downloads):
11+
Note you need to **accept EULA (End-User-License-Agreement)** from Cisco to install the software on your system. A **dialog will show up** during the installation.
1212

13-
```
14-
# Will install current Packet_Tracer821_amd64_signed.deb from the container and accept EULA (End-User-License-Agreement) (needs working tty)
15-
cp ./Packet_Tracer821_amd64_signed.deb /tmp/share/
16-
```
13+
# build.sh script:
14+
15+
The script will run a container then create a local image with Packet Tracer installed.
1716

18-
# Build the image and start new container
17+
You can then use that image to run a container with the application already installed: tags are editable on top of the script (variables).
1918

20-
Adding a shared volume to the container to install the app and also share files between the host and the container.
19+
# Download Ubuntu package from Cisco
2120

22-
Note: the container needs access to X11 socket for GUI apps to run. Sharing Display env + X11 socket and granting access to it with SELinux label.
21+
Signup or login to [skillsforall.com](https://skillsforall.com/resources/lab-downloads) to download the Ubuntu version.
22+
23+
You should get a .deb file (e.g Packet_Tracer821_amd64_signed.deb).
24+
25+
# build the image
2326

2427
```
25-
podman build -t img_packettracer -f dockerfile .
26-
podman run --name c_packettracer -dt -e DISPLAY -v /tmp/share:/SHARE:Z -v /tmp/.X11-unix:/tmp/.X11-unix --security-opt label=type:container_runtime_t img_packettracer
28+
mkdir tmp && cd tmp
29+
git clone https://github.com/lpwprojects/packettracer_container.git .
30+
cp ~/Downloads/Packet_Tracer821_amd64_signed.deb .
31+
chmod +x ./build.sh
32+
./build.sh
2733
```
2834

29-
# Install the app
35+
# Create new container from local image with the application
3036

3137
```
32-
podman exec -t -i c_packettracer /bin/bash
33-
cp /SHARE/Packet_Tracer821_amd64_signed.deb .
34-
apt install ./Packet_Tracer821_amd64_signed.deb
35-
[...]
36-
exit
38+
# Example with shared volume '/home/share' from host as '/SHARE' inside container (e.g import labs you download into Packet Tracer)
39+
podman run --name <CONTAINER NAME> -dt -e DISPLAY -v /home/share:/SHARE:Z -v /tmp/.X11-unix:/tmp/.X11-unix --security-opt label=type:container_runtime_t <LOCAL IMAGE NAME>
3740
```
38-
# Run the app
41+
42+
# Run the application
3943

4044
```
41-
# bashr: alias packettracer='podman start c_packettracer && podman exec c_packettracer packettracer ; podman stop c_packettracer'
45+
podman exec <CONTAINER NAME> packettracer
4246
43-
podman start c_packettracer
44-
podman exec c_packettracer packettracer
45-
# podman stop c_packettracer
47+
# ==> bashr: alias packettracer='podman start <CONTAINER NAME> && podman exec <CONTAINER NAME> packettracer ; podman stop <CONTAINER NAME>'
4648
```
4749

build.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#! /bin/bash
2+
3+
PTDEB=Packet_Tracer821_amd64_signed.deb
4+
DOCKERFILE=dockerfile
5+
IMG=img_packettracer
6+
CONT=c_packettracer
7+
8+
[ -f ./"$PTDEB" ] || exit 1
9+
[ -f ./"$DOCKERFILE" ] || exit 1
10+
if [ -d ./pt ] ; then
11+
echo "Please remove './pt' dir"
12+
exit 1
13+
fi
14+
15+
mkdir pt || exit 1
16+
cp "$PTDEB" ./pt/ || exit 1
17+
cp "$DOCKERFILE" ./pt/ || exit 1
18+
cd ./pt || exit 1
19+
20+
podman build -t $IMG -f "$DOCKERFILE" . || exit 1
21+
podman run --name $CONT -dt -e DISPLAY -v .:/SHARE:Z $IMG || exit 1
22+
23+
podman exec -t -i $CONT /bin/bash -c "apt install /SHARE/$PTDEB"
24+
25+
echo -e "\n\n"
26+
read -p "Accepted EULA successfully? " -n 1 -r
27+
echo
28+
if [[ $REPLY =~ ^[Yy]$ ]]
29+
then
30+
podman stop $CONT
31+
podman commit $CONT localhost/$IMG:latest || exit 1
32+
podman rm $CONT
33+
fi
34+
35+
echo -e "\n\n"
36+
echo "====================================="
37+
echo "==> Run new container with Packet Trancer and shared volume '/home/share' from host as '/SHARE' inside container:"
38+
echo "podman run --name $CONT -dt -e DISPLAY -v /home/share:/SHARE:Z -v /tmp/.X11-unix:/tmp/.X11-unix --security-opt label=type:container_runtime_t $IMG"
39+
echo
40+
echo "==> Exec Packet Tracer from running container:"
41+
echo "podman exec $CONT packettracer"
42+
echo "====================================="
43+
echo "DONE."

0 commit comments

Comments
 (0)