Changes

From SME Server
Jump to navigationJump to search
516 bytes removed ,  17:02, 13 July 2022
Tidy up for v10
Line 55: Line 55:     
===Contrib===
 
===Contrib===
 +
 +
yum install smeserver-extrarepositories-docker-ce
 +
signal-event yum-modify
 +
yum --enablerepo=smecontribs install smeserver-docker
 +
 +
(Note the contrib is still in smetest)
 +
 +
 +
Uses config entries
 +
 +
config setprop docker iptables false/true - default false
 +
 +
  config setprop  docker DNS [192,168.10.1,8.8.8.8] - defaults to LocalIP
 +
 +
  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
 +
 +
{{Note box: Note to self - probably needs quotes around "false" for iptables}}
 +
 +
config show docker
 +
status enabled/disabled - enabled by default
 +
iptables true/false - false by default to prevent docker manipulating iptables
 +
 +
config show containerd
 +
status enabled/disabled - enabled by default - called and used by docker
 +
 +
See if it works:
 +
 +
systemctl status docker
 +
 +
And test:
 +
 +
docker run hello-world
 +
 +
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
 +
chmod +x /usr/local/bin/docker-compose
 +
chgrp docker /usr/local/bin/docker-compose
 +
 +
A test compose file is installed.
 +
 +
cd /home/e-smith/files/docker/configs
 +
docker-compose up -d hello_world
 +
 +
Add your own templates to:
 +
 +
/etc/e-smith/templates/home/e-smith/files/docker/configs/docker-compose.yml
 +
 +
or:
 +
 +
/etc/e-smith/templates-custom/home/e-smith/files/docker/configs/docker-compose.yml
 +
 +
signal-event smeserver-docker-compose-update
 +
cd /home/e-smith/files/docker/configs
 +
docker-compose up -d my_hello
 +
 +
==Things to do==
   −
yum --enablerepo=smecontribs,epel install smeserver-docker
+
Plenty
   −
We looking at building an updated docker-compose rpm and using the docker-ce-stable repo
     −
We have added the docker repo to Extarepositories
+
==Notes==
   −
https://wiki.contribs.org/Extrarepositories
      
====Networking====
 
====Networking====
   −
{{WIP box | This is still a work in progress. the following are notes fro reference only}}
+
{{WIP box | This is still a work in progress. the following are notes for reference only}}
    
Docker attempts to guess what network to use and sets a bridged interface for it.
 
Docker attempts to guess what network to use and sets a bridged interface for it.
Line 74: Line 137:  
This allows access to any local services, and any ports in the container will appear locally
 
This allows access to any local services, and any ports in the container will appear locally
    +
v1 format
 
  --net="host"  
 
  --net="host"  
 +
 +
v2 + format
 +
 +
Docker
 +
--network host
 +
 +
Compose
 +
network_mode: host
    
This maps container port 80 to host port 8088
 
This maps container port 80 to host port 8088
Line 86: Line 158:  
  container.ip.add:8088
 
  container.ip.add:8088
   −
Using --net="host" means it is easier to connect to the container using the local IP address. Simple port forwarding/opening will suffice.
+
Using --network host means it is easier to connect to the container using the local IP address. Simple port forwarding/opening will suffice.
    
However, it exposes all ports on the container locally, and there may also be conflicts with local ports.
 
However, it exposes all ports on the container locally, and there may also be conflicts with local ports.
Line 101: Line 173:  
I am working on this currently but the LocalNetworking approach doesn't work. It probably need manipulation of the firewall with templates.
 
I am working on this currently but the LocalNetworking approach doesn't work. It probably need manipulation of the firewall with templates.
   −
==== Login to container====
+
=== Login to container===
    
If permitted, most containers can be logged into using this:
 
If permitted, most containers can be logged into using this:
Line 107: Line 179:  
docker exec -t -i -u root <container_name> /bin/bash
 
docker exec -t -i -u root <container_name> /bin/bash
   −
====Configuration====
     −
config show docker
+
===SME Server specifics===
status enabled/disabled - enabled by default
  −
iptables true/false - false by default to prevent docker manipulating iptables
  −
 
  −
config show containerd
  −
status enabled/disabled - enabled by default
  −
 
  −
====SME Server specifics====
   
By default Docker will store all images, containers and other data in:
 
By default Docker will store all images, containers and other data in:
 
  /var/lib/docker
 
  /var/lib/docker
Line 123: Line 187:  
  '''/home/e-smith/files/docker'''
 
  '''/home/e-smith/files/docker'''
   −
We now have systemd config files
     −
Note to self:
+
===Using a Docker image===
It is ''important'' that you adjust the config file ''before'' you start using docker otherwise it will create it's default storage location in /var/lib/docker.
     −
You can still change the storage location in a later stage by copying all data to the new location you've defined with the -g argument.
+
You should generally be prefer to use docker-compose for images.
   −
Or just restart with the new location.
     −
systemctl status docker
+
==Building your own images==
systemctl status containerd
+
* Notes
 +
Manual, or..
 +
https://github.com/docker/fig
 +
 
 +
 
 +
==Related articles of interest==
 +
* [http://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/ Container storage and (re)size]
 +
 
 +
===Setting up a (Private) Docker repository===
 +
TBA
    +
* https://blog.codecentric.de/en/2014/02/docker-registry-run-private-docker-image-repository/
   −
==Using a Docker image==
     −
You should generally be prefer to use docker-compose for images.
     −
The compose file is templated and makes managing docker images much easier.
+
==='Proposal test image:'===
 +
An application that requires Java, PHP, Apache, MySQL and LDAP. The localhost MySQL and localhost LDAP should be used by the application. The application should be publicly available either on a subdomain or specific port on the FQDN. The application should only be available between 08:00AM until 19:00PM.
 +
All application data should be incorporated by the default SME Sever backup mechanisms, including the image itself.
   −
A fragment needs adding here:
+
* Building the image based on centos6
 +
* Configure networking, bridges and ports
 +
* Start/restart and stop syntax of the application
 +
* Configure cron
   −
/etc/e-smith/templates-custom/home/e-smith/files/docker/configs/docker-compose.yml
     −
Each template fragment needs to be JSON compliant to work
        −
===general===
+
==General old notes==
 
The following methods and notes are left for reference.
 
The following methods and notes are left for reference.
   Line 244: Line 316:       −
==Building your own images==
+
===Docker Compose===
* Notes
  −
Manual, or..
  −
https://github.com/docker/fig
  −
 
  −
==='Proposal test image:'===
  −
An application that requires Java, PHP, Apache, MySQL and LDAP. The localhost MySQL and localhost LDAP should be used by the application. The application should be publicly available either on a subdomain or specific port on the FQDN. The application should only be available between 08:00AM until 19:00PM.
  −
All application data should be incorporated by the default SME Sever backup mechanisms, including the image itself.
  −
 
  −
* Building the image based on centos6
  −
* Configure networking, bridges and ports
  −
* Start/restart and stop syntax of the application
  −
* Configure cron
  −
 
  −
 
  −
==Setting up a (Private) Docker repository==
  −
TBA
  −
 
  −
* https://blog.codecentric.de/en/2014/02/docker-registry-run-private-docker-image-repository/
  −
 
  −
 
  −
==Docker Compose==
      
https://github.com/docker/compose/releases/tag/1.29.2
 
https://github.com/docker/compose/releases/tag/1.29.2
Line 272: Line 323:  
  chmod +x /usr/local/bin/docker-compose
 
  chmod +x /usr/local/bin/docker-compose
   −
==Shipyard web GUI==
+
===Shipyard web GUI===
 
Deprecated
 
Deprecated
 
There is a separate page on how to install Shipyard, the Docker web GUI [http://wiki.contribs.org/Shipyard here]
 
There is a separate page on how to install Shipyard, the Docker web GUI [http://wiki.contribs.org/Shipyard here]
      −
==Related articles of interest==
+
===Issues===
* [http://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/ Container storage and (re)size]
  −
 
  −
 
  −
==Things to do==
  −
 
  −
 
  −
==Issues==
      
This was a v9 issue. Leaving for reference.
 
This was a v9 issue. Leaving for reference.
Line 294: Line 338:  
If you don't use host networking, you use the internal IP address set with docker, but this address is unknown as a local network to SME and it will block any queries emanating from the container. I am looking at this with the contrib.
 
If you don't use host networking, you use the internal IP address set with docker, but this address is unknown as a local network to SME and it will block any queries emanating from the container. I am looking at this with the contrib.
   −
==Koozai SME v10==
+
==More Old Notes===
 
  −
We have a contrib to aid setup in testing.
  −
 
  −
===Repo setup===
  −
 
  −
db yum_repositories set docker-ce-stable repository \
  −
    BaseURL 'https://download.docker.com/linux/centos/7/$basearch/stable' \
  −
    EnableGroups no \
  −
    GPGCheck yes \
  −
    GPGKey https://download.docker.com/linux/centos/gpg \
  −
    Name 'Docker Stable' \
  −
    Visible yes \
  −
    status enabled
  −
 
  −
signal-event yum-modify
  −
 
  −
===Installation via contrib===
  −
 
  −
yum --enablerepo=extras,smetest install smeserver-docker
  −
signal-event post-upgrade;signal-event reboot
  −
 
  −
Uses config entries
  −
 
  −
docker iptables false/true - default false
  −
 
  −
docker DNS [192,168.10.1,8.8.8.8] - defaults to LocalIP
  −
 
  −
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 but this needs a reboot after initial install.
  −
 
  −
Probably needs quotes around "false" for iptables
  −
 
  −
See if it works:
  −
 
  −
systemctl status docker
  −
 
  −
And test:
  −
 
  −
docker run hello-world
  −
 
  −
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
  −
chmod +x /usr/local/bin/docker-compose
  −
chgrp docker /usr/local/bin/docker-compose
  −
 
  −
A test compose file is installed.
  −
 
  −
docker-compose up -d hello_world
  −
 
  −
Add your own templates to:
  −
 
  −
/etc/e-smith/templates/home/e-smith/files/docker/configs/docker-compose.yml
  −
 
  −
or:
  −
 
  −
/etc/e-smith/templates-custom/home/e-smith/files/docker/configs/docker-compose.yml
  −
 
  −
signal-event smeserver-docker-compose-update
  −
cd /home/e-smith/files/docker/configs
  −
docker-compose up -d my_hello
  −
 
  −
 
  −
==Old notes==
  −
 
      
The following are old notes.
 
The following are old notes.
Line 590: Line 568:  
  [Install]
 
  [Install]
 
  WantedBy=multi-user.target
 
  WantedBy=multi-user.target
 +
 +
 +
==Bugs==
 +
 +
Please raise bugs under the SME-Contribs section in {{BugzillaFileBug|product=|component=|title=bugzilla}}and select the smeserver-docker component or use
 +
{{BugzillaFileBug|product=SME%20Contribs|component=smeserver-docker |title=this link}}.
 +
 +
 +
{{#bugzilla:columns=id,product,version,status,summary |sort=id |order=desc |disablecache=1 |component=smeserver-docker |noresultsmessage="No open bugs found."}}
 +
 +
 +
==Changelog==
 +
 +
Only released version in smecontrib are listed here.
 +
 +
{{ #smechangelog: smeserver-docker }}
 +
    
   
 
   

Navigation menu