Line 55: |
Line 55: |
| | | |
| ===Contrib=== | | ===Contrib=== |
− | | + | yum --enablerepo=extras install epel-release. |
| yum install smeserver-extrarepositories-docker-ce | | yum install smeserver-extrarepositories-docker-ce |
| signal-event yum-modify | | signal-event yum-modify |
− | yum --enablerepo=smecontribs install smeserver-docker | + | yum --enablerepo=smecontribs,extras,epel install smeserver-docker |
| + | signal-event post-upgrade;signal-event reboot |
| | | |
| (Note the contrib is still in smetest) | | (Note the contrib is still in smetest) |
| | | |
| + | ====Avoiding conflicts==== |
| | | |
− | Uses config entries
| + | docker-compose templates used: |
| + | |
| + | smeserver-docker |
| + | 01version |
| + | 10HelloWorldTest |
| + | |
| + | smeserver-rocketchat |
| + | 20rocketchat |
| + | |
| + | ====config entries==== |
| | | |
| config setprop docker iptables false/true - default false | | config setprop docker iptables false/true - default false |
Line 71: |
Line 82: |
| config setprop docker DockerNetwork [IP range eg 192.168.100.0/24] - defaults to dockers own choice. Range is not yet checked for validity. | | config setprop docker DockerNetwork [IP range eg 192.168.100.0/24] - defaults to dockers own choice. Range is not yet checked for validity. |
| | | |
− | There is an action smeserver-docker-update | + | There is an action to update the core files: |
| | | |
− | {{Note box: Note to self - probably needs quotes around "false" for iptables}} | + | smeserver-docker-update |
| + | |
| + | {{Note box| Note to self - probably needs quotes around "false" for iptables}} |
| | | |
| config show docker | | config show docker |
Line 86: |
Line 99: |
| systemctl status docker | | systemctl status docker |
| | | |
− | And test:
| + | ====Testing==== |
| | | |
− | docker run hello-world
| + | We can run docker directly but the preferred method is to use compose |
− | | |
− | docker ps -a
| |
− | docker rm <id>
| |
− | | |
− | docker images
| |
− | docker rmi <id>
| |
− | | |
− | We can also use docker-compose:
| |
| | | |
| curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose | | curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose |
Line 114: |
Line 119: |
| | | |
| /etc/e-smith/templates-custom/home/e-smith/files/docker/configs/docker-compose.yml | | /etc/e-smith/templates-custom/home/e-smith/files/docker/configs/docker-compose.yml |
| + | |
| + | To expand the template: |
| | | |
| signal-event smeserver-docker-compose-update | | signal-event smeserver-docker-compose-update |
| cd /home/e-smith/files/docker/configs | | cd /home/e-smith/files/docker/configs |
| docker-compose up -d my_hello | | docker-compose up -d my_hello |
| + | |
| + | Using plain docker: |
| + | |
| + | docker run hello-world |
| + | |
| + | Other commands: |
| + | |
| + | docker ps -a |
| + | docker rm <id> |
| + | |
| + | docker images |
| + | docker rmi <id> |
| | | |
| ==Things to do== | | ==Things to do== |
Line 188: |
Line 207: |
| If permitted, most containers can be logged into using this: | | If permitted, most containers can be logged into using this: |
| | | |
− | docker exec -t -i -u root <container_name> /bin/bash | + | docker exec -t -i -u root <container_name> /bin/bash |
− | | |
| | | |
| ===SME Server specifics=== | | ===SME Server specifics=== |
Line 198: |
Line 216: |
| '''/home/e-smith/files/docker''' | | '''/home/e-smith/files/docker''' |
| | | |
| + | ===File permissions=== |
| + | |
| + | You may have issues writing to local filesystems from Docker images. |
| + | |
| + | First add something like this to your compose file |
| + | |
| + | volumes: |
| + | - /opt/uploads/:/opt/uploads/ |
| + | |
| + | You may need to find out what permissions are required. |
| + | |
| + | |
| + | In RocketChat I had to add a dummy user and group like this |
| + | |
| + | mkdir -p /opt/uploads |
| + | chmod 0777 /opt/uploads |
| + | |
| + | I then could upload and check the ID that docker users. I thins case it was 65533 |
| + | |
| + | So I then did: |
| + | groupadd -g 65553 rocketchat |
| + | useradd -s /sbin/nologin -u 65533 -d /dev/null -g rocketchat rocketchat |
| + | chmod 0744 /opt/uploads |
| + | |
| + | And then test again. |
| | | |
| ===Using a Docker image=== | | ===Using a Docker image=== |
Line 238: |
Line 281: |
| You will be flooded with available images from the Docker hub. This is because everyone can have a free account on Docker hub and create one repository for him/herself. We limit our testing to the official Centos repo. With all the other images, you are on your own and usage is at your own risk. | | You will be flooded with available images from the Docker hub. This is because everyone can have a free account on Docker hub and create one repository for him/herself. We limit our testing to the official Centos repo. With all the other images, you are on your own and usage is at your own risk. |
| | | |
− | ==Downloading a docker image=== | + | ===Downloading a docker image=== |
| To download the centos7 image to your local server, issue the following command as root: | | To download the centos7 image to your local server, issue the following command as root: |
| docker pull centos:centos7 | | docker pull centos:centos7 |