Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Twoje Imię Nazwisko | 8ac6e89137 | |
Twoje Imię Nazwisko | 3b14a1c2a1 | |
Twoje Imię Nazwisko | e583cc4c44 |
29
Dockerfile
29
Dockerfile
|
@ -1,10 +1,10 @@
|
|||
# Użyj najnowszego obrazu bazowego Debian
|
||||
FROM debian:latest
|
||||
|
||||
# Ustaw zmienną środowiskową DEBIAN_FRONTEND na noninteractive, aby uniknąć interaktywnych promptów podczas instalacji pakietów
|
||||
# Ustaw zmienną środowiskową DEBIAN_FRONTEND na noninteractive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Aktualizacja pakietów i instalacja wymaganych narzędzi wraz z python3 i python3-scapy
|
||||
# Aktualizacja pakietów i instalacja wymaganych narzędzi
|
||||
RUN apt-get update && apt-get install -y \
|
||||
iproute2 \
|
||||
curl \
|
||||
|
@ -22,19 +22,30 @@ RUN apt-get update && apt-get install -y \
|
|||
python3-scapy \
|
||||
iputils-ping \
|
||||
traceroute \
|
||||
ipcalc
|
||||
ipcalc \
|
||||
procps
|
||||
|
||||
# Ustawienie hasła dla użytkownika root
|
||||
RUN echo "root:rootpass" | chpasswd
|
||||
|
||||
# Tworzenie nowego użytkownika 'user' z hasłem 'pass' i dodanie do grupy sudo
|
||||
RUN useradd -m -s /bin/bash user && \
|
||||
RUN id -u user 2>/dev/null || ( \
|
||||
useradd -m -s /bin/bash user && \
|
||||
echo "user:pass" | chpasswd && \
|
||||
usermod -aG sudo user
|
||||
usermod -aG sudo user \
|
||||
) && \
|
||||
mkdir -p /home/user && \
|
||||
chown -R user:user /home/user
|
||||
|
||||
# Opcjonalnie: Ustawienie domyślnego użytkownika
|
||||
# USER user
|
||||
# Skopiowanie aplikacji do folderu /home/user/work
|
||||
COPY app /home/user/work
|
||||
|
||||
# Ustawienie domyślnego polecenia
|
||||
CMD ["/bin/bash"]
|
||||
# Ustawienie katalogu roboczego
|
||||
WORKDIR /home/user/work
|
||||
|
||||
# Ustawienie domyślnego użytkownika
|
||||
USER user
|
||||
|
||||
# Ustawienie domyślnego polecenia - uruchomienie serwera HTTP na porcie 3333
|
||||
CMD ["python3", "-m", "http.server", "3333"]
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
docker build --no-cache -t zoz:latest -f Dockerfile ..
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
Name: zoz
|
||||
Namespace: default
|
||||
Priority: 0
|
||||
Service Account: default
|
||||
Node: minikube/192.168.49.2
|
||||
Start Time: Wed, 30 Oct 2024 06:50:06 -0400
|
||||
Labels: run=zoz
|
||||
Annotations: <none>
|
||||
Status: Pending
|
||||
IP: 10.244.0.5
|
||||
IPs:
|
||||
IP: 10.244.0.5
|
||||
Containers:
|
||||
zoz:
|
||||
Container ID:
|
||||
Image: zoz:latest
|
||||
Image ID:
|
||||
Port: 3333/TCP
|
||||
Host Port: 0/TCP
|
||||
State: Waiting
|
||||
Reason: ErrImagePull
|
||||
Ready: False
|
||||
Restart Count: 0
|
||||
Environment: <none>
|
||||
Mounts:
|
||||
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-jdcwn (ro)
|
||||
Conditions:
|
||||
Type Status
|
||||
PodReadyToStartContainers True
|
||||
Initialized True
|
||||
Ready False
|
||||
ContainersReady False
|
||||
PodScheduled True
|
||||
Volumes:
|
||||
kube-api-access-jdcwn:
|
||||
Type: Projected (a volume that contains injected data from multiple sources)
|
||||
TokenExpirationSeconds: 3607
|
||||
ConfigMapName: kube-root-ca.crt
|
||||
ConfigMapOptional: <nil>
|
||||
DownwardAPI: true
|
||||
QoS Class: BestEffort
|
||||
Node-Selectors: <none>
|
||||
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
|
||||
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal Scheduled 31s default-scheduler Successfully assigned default/zoz to minikube
|
||||
Normal Pulling 17s (x2 over 31s) kubelet Pulling image "zoz:latest"
|
||||
Warning Failed 15s (x2 over 29s) kubelet Failed to pull image "zoz:latest": Error response from daemon: pull access denied for zoz, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
|
||||
Warning Failed 15s (x2 over 29s) kubelet Error: ErrImagePull
|
||||
Normal BackOff 4s (x2 over 28s) kubelet Back-off pulling image "zoz:latest"
|
||||
Warning Failed 4s (x2 over 28s) kubelet Error: ImagePullBackOff
|
|
@ -0,0 +1,6 @@
|
|||
f() {
|
||||
sudo docker run --rm -dit --privileged \
|
||||
-p 3333:3333 \
|
||||
--name "$1" zoz su - user;
|
||||
};
|
||||
f $1
|
2
__vp
2
__vp
|
@ -1,6 +1,6 @@
|
|||
f() {
|
||||
sudo docker run --rm -dit --privileged \
|
||||
-v "$(pwd)/app:/home/user/work" \
|
||||
-v "$(pwd)/../app:/home/user/work" \
|
||||
-p 3333:3333 \
|
||||
--name "$1" deb su - user;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue