amnezia-client/client/server_scripts/awg/run_container.sh
lunardunno bb6de0c22a
Implementing podman support (#867)
Еnable podman.socket
Disabling message: Emulate Docker CLI using podman.
Check which containerization application will be installed.
The default value for the verification service is set to docker
Add creation of aliases for podman for users with sudo
Removing AmneziaVPN aliases for podman-docker when cleaning the server.
Docker version with sudo for podman
Creating systemd service to autostart container when the server is rebooted, when using podman-docker
Clearing server for podman and removing container for podman
2025-03-18 19:06:33 +04:00

23 lines
970 B
Bash

# Run container
sudo docker run -d \
--log-driver none \
--restart always \
--privileged \
--cap-add=NET_ADMIN \
--cap-add=SYS_MODULE \
-p $AWG_SERVER_PORT:$AWG_SERVER_PORT/udp \
-v /lib/modules:/lib/modules \
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
--name $CONTAINER_NAME \
$CONTAINER_NAME
# Create service for podman
if [ -n "$(sudo docker --version 2>/dev/null | grep podman)" ]; then \
sudo sh -c "podman generate systemd --restart-policy=always -t 1 --name $CONTAINER_NAME 2>/dev/null > $DOCKERFILE_FOLDER/container-$CONTAINER_NAME.service";\
sudo sh -c "systemctl enable --now $DOCKERFILE_FOLDER/container-$CONTAINER_NAME.service && docker update --restart no $CONTAINER_NAME > /dev/null";\
fi
sudo docker network connect amnezia-dns-net $CONTAINER_NAME
# Prevent to route packets outside of the container in case if server behind of the NAT
#sudo docker exec -i $CONTAINER_NAME sh -c "ifconfig eth0:0 $SERVER_IP_ADDRESS netmask 255.255.255.255 up"