Archive for the ‘docker’ Category

Enable network communication between different docker containers

If we have 2 different docker networks, host from docker-compose network – 172.15.0.5 and second host is through docker start 172.16.0.2 mybash# iptables -L -n | grep DOCKER-ISOLATION DOCKER-ISOLATION-STAGE-1 all — 0.0.0.0/0 0.0.0.0/0mybash# iptables -L -n | grep DOCKER-ISOLATION DOCKER-ISOLATION-STAGE-1 all — 0.0.0.0/0 0.0.0.0/0 iptables –flush DOCKER-ISOLATION-STAGE-1iptables –flush DOCKER-ISOLATION-STAGE-1 After this command containers from 172.15.0.5 […]

Docker commiting custom container changes to docker repo

When you login inside docker container and modify it you might want to save the changes Do the following: docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3c467f494520 c9de8ac964a9 "/bin/bash" 31 minutes ago Up 31 minutes 0.0.0.0:81->80/tcp, 0.0.0.0:444->443/tcp mycontainerdocker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3c467f494520 c9de8ac964a9 "/bin/bash" 31 minutes […]

Docker push custom image to hub

docker tag mydockerimage myusername/mydockerimage:tagname or docker tag mydockerimage myusername/mydockerimage (if no tagname specified it will assign default one called "latest")   docker login -u myusername (it asks for a password)   docker push myusername/mydockerimagedocker tag mydockerimage myusername/mydockerimage:tagname or docker tag mydockerimage myusername/mydockerimage (if no tagname specified it will assign default one called "latest") docker login […]

Docker how-to add extra port to current container

$ docker run -d -t -p 81:80 -v /home/imran/Projects/tmptmp:/var/www/html –name mycontainer ubuntu:latest /bin/bash $ docker stop mycontainer $ docker commit mycontainer mydockerimage $ docker rm mycontainer $ docker run -d -t -p 81:80 -p 444:443 -v /home/imran/Projects/tmptmp:/var/www/html –name mycontainer myusername/mydockerimage:latest /bin/bash$ docker run -d -t -p 81:80 -v /home/imran/Projects/tmptmp:/var/www/html –name mycontainer ubuntu:latest /bin/bash $ docker […]

Docker run new container (without Dockerfile)

1.1 Run docker to make a mariadb container on windows no password docker run -d -it -p 3306:3306 -v C:/Users/username/Projects/projectname:/var/lib/mysql –name hostingnamedbs -e MYSQL_ALLOW_EMPTY_PASSWORD=1 –restart unless-stopped mariadb:10.11docker run -d -it -p 3306:3306 -v C:/Users/username/Projects/projectname:/var/lib/mysql –name hostingnamedbs -e MYSQL_ALLOW_EMPTY_PASSWORD=1 –restart unless-stopped mariadb:10.11 docker run –name myhostingercouk -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 8000:80 -p 3306:3306 -v //c/Users/username/Projects/projectname:/var/lib/mysql -d mariadb:10.11docker […]

Docker Basic Instructions

Docker Image – Read only layer Docker Container – Read/Write layer 1. Run docker bash in interactive mode for latest ubuntu image docker run -i -t ubuntu:latest /bin/bashdocker run -i -t ubuntu:latest /bin/bash 2. Run docker bash in server mode for latest ubuntu image docker run -d -t ubuntu:latest /bin/bashdocker run -d -t ubuntu:latest /bin/bash […]

Benefits of running web app inside docker

Your server itself will not have a big stack installed, like LAMP: all your server needs to know is how to run docker containers. If you deploy an app with a vulnerability and hackers gain root, they will only have root inside a single docker container, and can’t get at your host system. If you […]