Posts

Showing posts with the label docker

THE ULTIMATE DOCKER CHEAT SHEET

  1. RUN a CONTAINER (I) Start new container from an image:  docker run IMAGE_NAME (II) And assign it a name:  docker run --name CONTAINER _NAME IMAGE_NAME (III) To map a port:  docker run -p HOST_PORT:CONTAINER_PORT IMAGE (IV) To MAP all port:  docker run -P IMAGE_NAME (V) And Start a Container in background:  docker run -d IMAGE_NAME (VI) And Assign it a HOST NAME:  docker run --hostname HOSTNAME IMAGE_NAME (VII) And add a DNS entry or HOST entry in /etc/hosts file:  docker run  --add-host  HOSTNAME:IP IMAGE (VIII) And map a local directory (volume) to a container:  docker run -v HOST_DIR:TARGET_DIR IMAGE_NAME (IX)   ALL IN ONE Example :  docker run --name my_container -p 80:80 -v /home/data/:/var/www/html/--add-host test.ac.in:10.246.10.6 --hostname nginx_host -d nginx 2. MANAGE CONTAINERS (I) Show List of all running containers :  docker ps (II) Show List of all running and stop containers :  docker p...

ADVANCED DOCKER COMMAND CHEAT SHEET

  Remove all images : docker rmi $(docker images -q) Remove all running containers: docker rm -f $(docker ps -q) Remove all Containers: docker rm -f $(dcoker ps -aq) Remove all dangling (unused) container and images: docker system prune -a Create volume : docker volume create List volume: docker volume ls Remove Volume: docker volume rm Inspect Volume: docker volume inspect Remove Stop Containers: docker rm $(docker ps -q -f “status=exited”) Push an image to a registry: docker push [registry]/[username]/<image-name>:[tag] Run a detached container in a previously created container network: $ docker network create mynetwork & $ docker run — name mywildfly-net -d — net mynetwork \ -p 8080:8080 jboss/wildfly Push an image to a registry: docker push [registry]/[username]/<image-name>:[tag] Build Image with diffrent dockerfile name: docker build -t test -f DockerfileTest .

Implement Grafana with Prometheus in Docker

  Pull all the packages docker pull prom/prometheus:latest docker pull prom/node-exporter:latest docker pull grafana/grafana:latest docker pull influxdb:latest Configure Prometheus mkdir -p /etc/prometheus vi prometheus.yml # Paste below Lines in prometheus.yml # scrape configuration scraping a Node Exporter and the Prometheus # # # #server itself scrape_configs: # Scrape Prometheus itself every 5 seconds. - job_name: ‘prometheus’ scrape_interval: 5s static_configs: - targets: [‘10.x.x.x:9090’] Run promrtheus docker run -d -p 9090:9090 --name prometheus -v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus:latest --config.file=/etc/prometheus/prometheus.yml Run Grafana docker run -d -p 3000:3000 --name grafana -e “GF_SECURITY_ADMIN_PASSWORD=admin_password” -v ~/grafana_db:/var/lib/grafana grafana/grafana:latest Run influxdb (optional): If want to store data docker run -d --name=influxdb --restart on-failure -p 8086:8086 -v influxdb_data:/var/lib/i...

Deploy Drupal with MySQL in Docker Container

Image
  FIRST METHOD Before we install Drupal, we need to deploy MySQL. This is easily done with Docker by running the following command. In this command, replace “MYSQL-NAME” with a name for your MySQL Docker container. Also, replace “MYSQL-PASSWORD” with a new password for the container’s MySQL instance. Record both of these for later. docker run --name MYSQL-NAME -e MYSQL_ROOT_PASSWORD=MYSQL-PASSWORD -d mysql:latest Deploying and Configuring Drupal with Docker Our next step is to deploy a Drupal Docker container, connect it to your MySQL container, and finish configuring Drupal. Follow these steps. Run the following command. Replace “DRUPAL-NAME” with a name for your Drupal container. Replace “MYSQL-NAME” and “MYSQL-PASSWORD” with the values you used for your MySQL Docker container in the previous section. docker run --name DRUPAL-NAME --link MYSQL-NAME:mysql -p 8080:80 -e MYSQL_USER=root -e MYSQL_PASSWORD=MYSQL-PASSWORD -d drupal Go to  http://YOUR.VPS.IP:8080/  in ...