Wednesday 14 December 2016

Install Docker and Docker Compose


Compose is a tool for defining and running multi-container Docker applications.
With Compose, you use a Compose file to configure your application’s services.
Then, using a single command, you create and start all the services from your configuration.

Install Docker in Ubuntu 14.0.4 AWS

0. Add below line to the /etc/hosts to help resovle the host
10.0.xx.xx ip-10-0-xx-xx

1. update your server.
$ sudo apt-get update

2. download and execute install script.

$ wget -qO- https://get.docker.com/ | sh

3. use Docker as non-root user by adding your current user to the “docker” group.
$ sudo usermod -aG docker [current-user]

4. install Docker compose
$ sudo apt-get install python-pip

$ sudo pip install docker-compose

5. Install docker-machine

$ curl -L https://github.com/docker/machine/releases/download/v0.10.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine
$ chmod +x /tmp/docker-machine
$ sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

1. Clean all docker contains


$ docker rm `docker ps -aq`

2. Show all contains

$ docker ps -a

3. Check which containers are running

$ docker-compose ps

4. Start docker as a Background

$ docker-compose -f docker-compose.yml build
$ docker-compose up -d

5. Stops running containers without removing them

$ docker-compose stop

6. Stops containers and removes containers, networks, volumes, and images created by Up.

$ docker-compose down


7. Check IP of a docker container:

$ docker inspect $CID

docker logs 43194450

https://docs.docker.com/compose/gettingstarted/
https://vexxhost.com/resources/tutorials/how-to-install-and-use-docker-on-ubuntu-14-04/

No comments:

Post a Comment