You can use Docker to have a local CONSUL installation for development if:
You're having troubles having prerequisites installed.
You want to do a quick local installation just to try CONSUL or make a demo.
You prefer not to interfer with other rails installations.
You should have installed Docker and Docker Compose in your machine:
You can follow the official docker install​
Or if you have homebrew and cask installed you can just:
brew install dockerbrew install docker-composebrew cask install dockeropen -a docker
You'll be asked to give Docker app permissions and type your password, then you're set.
Install Docker:
sudo apt-get updatesudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609Dsudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'sudo apt-get updateapt-cache policy docker-enginesudo apt-get install -y docker-engine
Install Docker Compose
sudo curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)"sudo chmod +x /usr/local/bin/docker-compose
Pending to be completed... Contributions Welcome!
Clone the repo on your computer and enter the folder:
git clone git@github.com:consul/consul.gitcd consul
Then lets create our secrets and database config files based on examples:
cp config/secrets.yml.example config/secrets.ymlcp config/database-docker.yml.example config/database.yml
Then you'll have to build the container with:
docker build -t consul .
Create your app database images:
docker-compose up -d database
Once built you can initialize your development DB and populate it with:
docker-compose run app rake db:createdocker-compose run app rake db:migratedocker-compose run app rake db:seeddocker-compose run app rake db:dev_seed
Pending to be completed... Contributions Welcome!
Now we can finally run the application with:
docker-compose up
And you'll be able to access it at your browser visiting http://localhost:3000​
Additionally, if you want to run the rails console just run in another terminal:
docker-compose run app rails console
To verify the containers are up execute:
docker ps .
You should see output similar to this: ​
Pending to be completed... Contributions Welcome!
Run these commands at Consul's directory, to erase all your previous Consul's Docker images and containers. Then restart the Docker installation process:
Remove all CONSUL images:
docker-compose down --rmi all -v --remove-orphans
Remove all CONSUL containers
docker-compose rm -f -s -v
Verify if there is some container yet:
docker ps -a
Case positive, remove each one manually:
docker container rm <container_id>