Skip to content

Instantly share code, notes, and snippets.

@kilfu0701
Last active May 5, 2017 07:10
Show Gist options
  • Save kilfu0701/ff84c4968b4307add3a25854e2b742fc to your computer and use it in GitHub Desktop.
Save kilfu0701/ff84c4968b4307add3a25854e2b742fc to your computer and use it in GitHub Desktop.
[Docker] Quick start with docker. (For Ubuntu 16.04 above)
### Docker MEMO
# install
sudo apt-get update
sudo apt-get install -y docker.io
sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
# download image
docker pull ubuntu:17.04
# prepare your own Dockerfile
mkdir -p ~/docker/web1
cd ~/docker/web1
cat >Dockerfile <<EOL
FROM ubuntu:17.04
MAINTAINER kilfu0701 <[email protected]>
RUN apt-get -qq update
RUN apt-get -qqy install ruby ruby-dev
RUN gem install sinatra
EXPOSE 8000
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
EOL
# show current images
docker images
docker ps -a
# run a container with image
docker run -t -i fu/web:v1 /bin/bash
# add tag for image
docker tag <ID> fu/web:django_app
# delete container
docker rm <ID>
docker rm -f <ID>
# rebuild a image with updated Dockerfile
docker build --rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment