Running TurnkeyLinux on Digital Ocean’s Docker instance
In this tutorial we will look at setting up a docker host using Digital Oceans Docker Droplet. Once this host is setup we’ll then pull down a Turnkeylinux LAPP docker container and spin that up. We’ll then log into that container and do some stuff.
Setup Droplet
Set up a Digital Ocean Droplet with Docker. Once the droplet has spun up, get your password from your email and then log in.
Spin Up TurnkeyLinux
Log in as root.
Note that on your first log in you will have to retype your password and then set a new password of your own by tying it in and then typing it in again to confirm it.
Now that your logged in run
docker pull turnkeylinux/lapp-14.1
Spin Up a Turnkeylinux LAPP instance and login interactively, replace NEW_PASSWORD with your own
CID=$(CID=$(docker run -i -t -d turnkeylinux/lamp-14.1:latest) CIP=$(docker inspect -format='{{.NetworkSettings.IPAddress}}' $CID) docker logs $CID | grep "Random initial root password"docker exec -t -i $CID /bin/bash echo "root:NEW_PASSWORD"|chpasswd
Production
Note that for production you probably want to standardise the ports your using for consistency, in that case run the docker container using these settings
CID=$(docker run -i -t -d -p 80:80 -p 443:443 -p 12322:12322 -p 12321:12321 -p 12320:12320 -p 2222:22 -p 5432:5432 turnkeylinux/lapp-14.1)
Useful Docker Commands:
Stop all containers and delete them
docker kill $(docker ps -q) docker rm $(docker ps -a -q)
List docker running containers, -a shows all containers
docker ps docker ps -a
Stopping Containers
docker stop [container] #Stop a running container
docker start [container] #Start a running container docker kill [container] #Kill a running container, must first be stopped docker rm [container]
Kill all running containers
docker kill $(docker ps -q)
Delete all stopped containers (including data-only containers)
docker rm $(docker ps -a -q)
Delete all ‘untagged/dangling’ () images
docker rmi $(docker images -q -f dangling=true)
Delete ALL images
docker rmi $(docker images -q)