Skip to content

Docker Cheatsheet

Dockerfile

FROM ubuntu:latest

USER root
WORKDIR /root

COPY ENTRYPOINT.sh /

RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    iproute2 \
    iputils-ping \
    mininet \
    net-tools \
    openvswitch-switch \
    openvswitch-testcontroller \
    tcpdump \
    vim \
    x11-xserver-utils \
    xterm \
 && rm -rf /var/lib/apt/lists/* \
 && chmod +x /ENTRYPOINT.sh

EXPOSE 6633 6653 6640

ENTRYPOINT ["/ENTRYPOINT.sh"]

Entrypoint.sh

#!/usr/bin/env bash

service openvswitch-switch start
ovs-vsctl set-manager ptcp:6640

bash

service openvswitch-switch stop

build.sh

#!/bin/sh

docker build -t mininet-docker:latest .

run.sh

#!/bin/sh

docker run -it --privileged --env DISPLAY=$(hostname):0.0 mininet-docker:latest 

openshell.sh

#!/bin/sh

docker exec -it $(docker ps |grep mininet-docker | cut -f1 -d' ') /bin/bash

Commands


Last update: 2023-03-30