Last active
March 16, 2020 06:44
-
-
Save sapslaj/ad07f37a5b8f12213dfe2931788864e5 to your computer and use it in GitHub Desktop.
Cisco Packet Tracer 7 Inside a Docker Container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
# Replace 1000 with your user / group id | |
RUN export uid=1000 gid=1000 && \ | |
mkdir -p /home/pt && \ | |
echo "pt:x:${uid}:${gid}:PacketTracer:/home/pt:/bin/bash" >> /etc/passwd && \ | |
echo "pt:x:${uid}:" >> /etc/group && \ | |
echo "pt ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/pt && \ | |
chmod 0440 /etc/sudoers.d/pt && \ | |
chown ${uid}:${gid} -R /home/pt | |
RUN apt-get update -y | |
RUN apt-get install -y \ | |
libqt4-gui \ | |
libqt4-webkit | |
ADD PacketTracer70 /opt/pt | |
USER pt | |
ENV HOME /home/pt | |
ENV PTDIR /opt/pt | |
CMD LD_LIBRARY_PATH=$PTDIR/lib $PTDIR/bin/PacketTracer7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env sh | |
if [ ! -d $HOME/pt ]; then | |
mkdir -p $HOME/pt; | |
fi | |
if [ ! -f $HOME/.packettracer ]; then | |
touch $HOME/.packettracer | |
fi | |
docker run -it --rm \ | |
--net host \ | |
--privileged=true \ | |
-v $HOME/pt:/home/pt/pt:Z \ | |
-v $HOME/.packettracer:/home/pt/.packettracer \ | |
-v $HOME/Downloads:/home/pt/Downloads \ | |
-v /tmp/.X11-unix:/tmp/.X11-unix \ | |
-e DISPLAY=unix$DISPLAY \ | |
packettracer7 |
Hi, i'm new in docker, how do i run the PT after i create Dockerfile and packettracer7.sh.
Should i docker-compose and what is the command to run the PT.
Hope you can help me.
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It works for me, but i'm wondering how it could be launched from cisco website when student start an exam. Probably the container should also include firefox because the container PT fails to be launched if firefox is on the host, i don't understand exactly why yet i made a link (ln -s) between /usr/local/bin/packettracer and your script but i'm not sure this the right way because probably it directly needs a binary and not script ... can you comment on that ?
I also added libqt5designer5 and libicu52 libraries and succeeded to launch the newpackettracer version 7.1 from your container ... however i have not tested it thoroughly so i'm not sure that everything works, ...