Posts

Showing posts with the label docker

Digital Marketing

How to quickly set up your own personal VPN server with Docker

SoftEther VPN  is also a very good option which claims to be faster than OpenVPN SoftEtherVPN CID=$(docker run -d --privileged -p 1194:1194/udp -p 443:443/tcp jpetazzo/dockvpn) docker run --rm -t -i -p 8888:8080 --volumes-from $CID jpetazzo/dockvpn serveconfig Check docker is running: $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 88fdb2af8888 jpetazzo/dockvpn:latest "/bin/sh -c run" About a minute ago Up About a minute 0.0.0.0:1194->1194/udp, 8080/tcp, 0.0.0.0:443->443/tcp boring_heisenberg To fetch the config open up a webbrowser and connect to your docker box’s IP on port 8080. You’ll likely get some security errors because this is being served over HTTPS without the correct certificates. It’s safe to ignore these errors. You can save it as “ goyun.info ” or similar. curl -k https://localhost:8888 | tee config....

How to quickly set up your own personal VPN server with Docker

SoftEther VPN  is also a very good option which claims to be faster than OpenVPN SoftEtherVPN CID=$(docker run -d --privileged -p 1194:1194/udp -p 443:443/tcp jpetazzo/dockvpn) docker run --rm -t -i -p 8888:8080 --volumes-from $CID jpetazzo/dockvpn serveconfig Check docker is running: $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 88fdb2af8888 jpetazzo/dockvpn:latest "/bin/sh -c run" About a minute ago Up About a minute 0.0.0.0:1194->1194/udp, 8080/tcp, 0.0.0.0:443->443/tcp boring_heisenberg To fetch the config open up a webbrowser and connect to your docker box’s IP on port 8080. You’ll likely get some security errors because this is being served over HTTPS without the correct certificates. It’s safe to ignore these errors. You can save it as “ goyun.info ” or similar. curl -k https://localhost:8888 | tee config....

Fixed Unit docker.service could not be found on Ubuntu installed by snap

Temporary solution: Run the command export PATH=$PATH:/snap/bin Permanent solution: Edit /etc/environment and add /snap/bin in the list then restart your system. From $ docker.help Docker snap: Docker Linux container runtime. Due to the confinement issues on snappy, it requires some manual setup to make docker-snap works on your machine. We'll take you through the steps needed to set up docker snap work for you on ubuntu core and ubuntu classic. On Ubuntu classic, before installing the docker snap, please run the following command to add the login user into docker group.     sudo addgroup --system docker     sudo adduser $USER docker     newgrp docker On Ubuntu Core 16, after installing the docker snap from store, you need to connect the home interface as it's not auto-connected by default.     sudo snap connect docker:home :home Then have fun with docker in snappy. ubuntu@ip-172-31-8-122:~$  sudo docker run hello-world Unable to find image '...

Install Docker Compose on CentOS/Fefora

[ec2-user@ip-172-31-5-206 my]$ sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                  Dload  Upload   Total   Spent    Left  Speed 100   638  100   638    0     0   3112      0 --:--:-- --:--:-- --:--:--  3112 100 11.1M  100 11.1M    0     0  9560k      0  0:00:01  0:00:01 --:--:-- 13.2M [ec2-user@ip-172-31-5-206 my]$ sudo chmod +x /usr/local/bin/docker-compose [ec2-user@ip-172-31-5-206 my]$ docker-compose --version docker-compose version 1.23.1, build b02f1306

Tomcat-on-Docker-example.Dockerfile

Alpine makes a great docker container

Alpine is so small and optimized to be run in RAM. It also might make a good controller for several docker containers. Alpine Linux is a Linux distribution based on musl and BusyBox, designed for security, simplicity, and resource efficiency. It uses a hardened kernel and compiles all user-space binaries as position-independent executables with stack-smashing protection. Because of its small size, it is heavily used in containers providing quick boot-up times.

Docker multi-stage builds

With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the final image.

List docker James domains

$ docker exec james java -jar /root/james-cli.jar -h 127.0.0.1 -p 9999 listdomains james.local james.linagora.com localhost 172.18.0.7 ListDomains command executed sucessfully in 318 ms.

Run as many docker RUN commands as possible in the same layer

Shell Format The shell format looks as follows: RUN executable param1 param2 Exec Format The exec format looks as follows: RUN ["executable", "param1", "param2"] The docker RUN command can use either of these forms. When running in shell form, a backslash must be used to continue the RUN instruction onto the next line. To reduce the number of layers produced it’s recommended to run as many RUN commands as possible in the same layer, for example like so: RUN mkdir -p /opt/test/config && \  mkdir -p /opt/test/lib There is no functional reason to have a layer containing only one of these commands, so they are merged to reduce layer complexity.

Run AWS SAM CLI from Docker

AWS-SAM-CLI-on-docker

Pushing the container to Docker Hub

docker commit -m "your comment" -a "Your FULL NAME" docker-name-or-id your-Docker-Hub-user-name/docker-image-name:latest Next we need to login to Docker Hub with the command: docker login docker push your-Docker-Hub-user-name/docker-image-name

Run AWS CLI from Docker

$ alias aws='docker run --rm -tiv $HOME/.aws:/root/.aws -v $(pwd):/aws i88ca/aws-cli aws' $ aws --version aws-cli/2.0.1 Python/3.7.3 Linux/4.14.154-128.181.amzn2.x86_64 botocore/2.0.0dev5 https://github.com/i88ca/aws-cli

Fixed: docker IPv4 forwarding is disabled

Problem: $ aws help WARNING: IPv4 forwarding is disabled. Networking will not work. Solution: # echo "net.ipv4.ip_forward=1"  >> /etc/sysctl.conf # systemctl restart network # sysctl net.ipv4.ip_forward net.ipv4.ip_forward = 1

Checking Container Logs

When a container is either running in the background (it has been forked with `docker run -d`), or it has exited early, it can be useful to see the container logs. docker logs <container-id/alias> This will print out the current content of the container logs to the terminal. To follow these logs, add the -f parameter. To see timestamps with the logs, use the -t parameter.

Docker Networking

When running a container, the -p option maps a port on the host to a port on the container being run. If no port mappings are specified the container is still accessible, but only from the host running the Docker daemon. Docker handles a collection of networks; the default one is named ‘bridge’, and will allow containers running on the same machine to communicate. You can inspect this network by running the following command: docker network inspect bridge This will print out the details of the bridge network, and within that the IPs of containers running on it. You can read more about Docker networking here: https://docs.docker.com/network/.

Docker Jenkins initial admin password

Jenkins initial setup is required. An admin user has been created and a password generated. Docker Jenkins initial admin password can be found at: /var/jenkins_home/secrets/initialAdminPassword For docker pull jenkins/jenkins

How to install Docker for Oracle Linux

You can install Docker for Oracle Linux from the Add-ons Channel for Oracle Linux, either via the  Unbreakable Linux Network  or the  Oracle Linux yum sever . 

How to reconnect to a docker container

If you want to continue from what you left in the docker: Usage example docker exec -it f32de2737e88 bash