Setup Alpine as a Docker Host
Alpine linux is being used as a base for many docker images. Unfortunately I haven’t seen many posts or guides on how to setup alpine as a docker host. So let’s change that.
- Download Alpine Linux, burn as usual with
ddand boot it.
- Login as root, run
setup-alpineand breeze through it.
I installed in sys mode since I wanted the system to be written to the disk.
After rebooting you should have an Alpine linux installation. Onto my personal configuration.
//Create users group # addgroup users //Create user newuser in users group with ash as default shell # adduser -s /bin/ash -G users newuser //Install sudo # apk add sudo
I then edited the sudo file using
visudo and uncommented
%wheel ALL=(ALL) ALL .
Files to edit
// Uncomment (for alpine 3.4): http://mirrors.2f30.org/alpine/v3.4/community http://mirrors.2f30.org/alpine/edge/testing
// Add newuser (or whatever name you chose) // to the wheel group. wheel:x:10:root,newuser
// Add or Uncomment Port 20022 #for example PermitRootLogin no
After editing these files, I change to an SSH connection and use
ssh-copy-id to copy over a pubkey.
Adding the following lines to /etc/ssh/sshd_config once the key has been copied.
PasswordAuthentication no ChallengeResponseAuthentication no
Another thing you might consider doing is using a firewall like ufw, awall or just configure the iptables (just remember Docker will probably ignore your settings because it writes to iptables directly).
# apk add docker # rc-update add docker boot # service docker start # sysctl -w kernel.grsecurity.chroot_deny_chmod=0 # sysctl -w kernel.grsecurity.chroot_deny_mknod=0
Should install and setup docker according to the wiki.
After this you’ll be able to use docker via
sudo docker or just
docker if you add yourself to the
(The ArchWiki explains why maybe adding users to the
docker group is not a good idea.)
Personal Run Scripts
(This was written before
docker-compose was a thing, use that instead)