by Daniel Romero / @infoslack
www.enjoei.com.br / jobs@enjoei.com.br
# Opção run com interatividade:
$ docker run -i -t image_name [command]
# Executando em background:
$ docker run -d image_name
# Eliminando após o uso:
$ docker run --rm -it image_name [command]
# Iniciar container interativo:
$ docker run -it ubuntu bash
# Realizar alterações:
$ sudo apt-get update && apt-get install -y ruby
# Encerrar e commitar;
$ docker commit [image_id]
FROM ubuntu
RUN apt-get update && apt-get install -y nginx
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
# Opção build seguido de user/serviço e dockerfile
$ docker build -t infoslack/nginx [path_dockerfile]
# Login em https://registry.hub.docker/com
$ docker login
# Baixando imagens:
$ docker pull image_name
# Buscando imagens:
$ docker search name
# Enviando imagens:
$ docker push infoslack/nginx
FROM rails:onbuild
$ docker run -it --rm --user "$(id -u):$(id -g)" \
-v "$PWD":/usr/src/app \
-w /usr/src/app rails \
rails new webapp
$ docker run --name my-rails-app \
-p 8080:3000 \
-d my-rails-app
db:
image: postgres:9.3
volumes:
- "~/.volumes/app/db/:/var/lib/postgresql/data/"
expose:
- 5432
app:
build: .
command: bundle exec rails s
volumes:
- .:/usr/src/app
ports:
- 80:3000
links:
- db