Skip to content

Instantly share code, notes, and snippets.

@delbetu
Last active November 28, 2019 19:39
Show Gist options
  • Save delbetu/89ff701ae983b64d526d36b43031e3bf to your computer and use it in GitHub Desktop.
Save delbetu/89ff701ae983b64d526d36b43031e3bf to your computer and use it in GitHub Desktop.
Getting Dev.to up and running locally

Docker Cheat Sheet

docker

Create Dockerfile --> contiene el provisioning (todo lo que tiene que tener instalado) base image -> ruby:2.3.0 RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs

RUN mdkir /myapp WORKDIR /myapp

ADD Gemfile /myapp/Gemfile ADD Gemfile.lock /myapp/Gemfile.lock

RUN bundle install

ADD ./myapp

docker-compose.yaml -> declaro cuales son los servicios que van a correr y las dependencias uno del otro

services: db: ... app: build: . command: bundle exec raikls s volumes: - ....

docker-compose run .... --> corre ese comando en el servicio de docker Es como tener heroku corriendo localmente

installing docker on Arch

pacman -S docker systemctl start docker.service docker info --> permission denied solve this by adding current user to the group docker $ newgrp docker to get access to that group in your current shell

I got this error after installation Cloud-CV/Fabrik#510

Removed pacman installation and followed official instructions to install via curl just download the binary and place it on /usr/local/bin/docker-compose

Docker flow

Creo el provisioning dentro de un Dockerfile Configuro los servicios que correran en esa imagen con docker-compose.yaml El docker-compose cada servicio tiene un comando Los servicios pueden depender uno del otro para levantar un servicio hago docker-compose up levanta todos los servicios

un servicio puede depender de una imagen El docker-compose up tambien genera una nueva imagen

Lo primero que hace docker-comose up es crear una network

como levanto la imagen?

Docker concepts

Layer of container images

Docker api

list running containers

docker ps

stop kill rm container

docker stop|kill|rm container_id

List docker images

docker images

Delete image

docker rmi image_id

Delete all images, container, volumes, and networks not associated with a container

docker system prune

Grab IP of running container

$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment