curl $(docker-machine ip default):3000
List containers:
sudo docker ps
Shell access to running container
sudo docker exec -it <container name> bash
Access psql
psql -h 10.0.0.1 -U postgres -d prod_master
Build an image:
docker build -t timothyclayton/docker_what:red .
Run/build a container (as a daemon with port forwarding):
docker run -d -p 3001:3000 timothyclayton/docker_what:red
List docker containers:
docker ps -a
Remove a docker container:
docker rm <container_name>
Remove all containers:
docker rm $(docker ps -aq)
Remove containers before images...
List docker images:
docker images
Remove a docker image:
docker rmi <image id>
Remove ALL docker images:
docker rmi $(docker images -q)
FROM ruby:2.2.2
# Run updates
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
# Set up directory
RUN mkdir /docker_what
# Add the rest of our app's code
WORKDIR /docker_what
ADD Gemfile /docker_what/Gemfile
ADD . /docker_what
# Set up gems...there is a way to do this so it doesn't reinstall gems that haven't changed
RUN bundle install
# Clean up APT when done.
# RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set ENV if needed
# ENV MONGOID_ENV staging
# ENV RAILS_ENV staging
# For port forwarding to local machine (mac)
EXPOSE 3000
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]