Installing docker on EC2 instance
I’ve set a few PDP goals, one of which is to work in a more continuous integration (CI) kind of way. I’m planning on writing a series of documents to cover the areas that I’m working with, for my own future reference, and for anyone else who may wish to learn about it (or indeed point out where I’m going wrong).
The basic setup that I will be working with is Bitbucket and Jenkins.
How to install Docker on Ubuntu 16.04 LTS
ssh onto your box and setup the docker repository:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Install Docker CE
sudo apt-get update
sudo apt-get install docker-ce
Verify the install:
sudo docker run hello-world
Setup docker to run without sudo:
sudo usermod -a -G docker <user>
example:
sudo usermod -a -G docker ubuntu
Log out and log back in to pick up the new docker group permissions, then verify the user can run docker without sudo:
docker info
If you see some sort of error, the user modification hasn’t worked and you should fix that.
Run docker:
sudo service docker start
How to install and run swagger-ui via docker
docker pull swaggerapi/swagger-ui
docker run -p 80:8080 swaggerapi/swagger-ui
To run a different api by default:
docker run -p 80:8080 -e API_URL=https://s3-eu-west-1.amazonaws.com/ee-dtp-static-s3-test/swagger/feature_file_separation/bundled.json swaggerapi/swagger-ui
To run in the background:
docker run -p 80:8080 -e API_URL=https://s3-eu-west-1.amazonaws.com/ee-dtp-static-s3-test/swagger/feature_file_separation/bundled.json swaggerapi/swagger-ui &