Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Docker usage examples
* guides:
* Docker hub:
# Useage of existiing images - jira example (all in one)
* docker pull cptactionhank/atlassian-jira:latest # pull the image from docker hub
* docker run -p 8080:8080 cptactionhank/atlassian-jira:latest # run's a container with a jira instance
* http://docker-host:8080/
# Useage of existing images - wordpress example (db and webserver)
* docker pull mysql # pull the image from docker hub
* docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql # runs an mysql container
* docker pull wordpress # pull the image from docker hub
* docker run --name some-wordpress --link some-mysql:mysql -e WORDPRESS_DB_PASSWORD=mysecretpassword -d wordpress # run's a container with wordpress instance
* http://docker-host:8080/
# Rails with Docker - on_ruby example
* git clone branch: docker
** docker build -t on_ruby . # Builds the on_ruby docker image (see Dockerfile)
** docker pull postgres # pull the image from docker hub
** docker run --name my_db -e POSTGRES_USER=myuser -e POSTGRES_PASSWORD=mysecretpassword -d postgres # run's a container with postgress instance
** docker run --rm --link my_db:db -v ~/thomet-dev/on_ruby:/var/www -e DB_HOST=db -e DB_USERNAME=myuser -e DB_PASSWORD=mysecretpassword on_ruby rake db:setup # run's a container with the rake db:setup command and removes the container afther that
** docker run --name on_ruby --link my_db:db -v ~/thomet-dev/on_ruby:/var/www -e DB_HOST=db -e DB_USERNAME=myuser -e DB_PASSWORD=mysecretpassword -p 5000:5000 on_ruby foreman start # run's a container with on_ruby application
** open # don't forgott the entry in /etc/hosts in your host system (also etc.)
# Tools
* fig:
* install on macos: brew install fig
* in the on_ruby project:
** see fig.yml in project
** fig pull # pulls all images from docker hub
** fig run webserver rake db:setup # runs the rake db:setup for setup the database
** fig up # runs the application and database server
* NSEnter:
** how-to use with boot2docker:
** linux: nsenter onruby_webserver_1
** mac: docker-enter onruby_webserver_1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment