├── .gitignore ├── README.asciidoc ├── consul ├── docker-compose.yml └── readme.adoc ├── couchbase-bucket ├── Dockerfile ├── data │ └── zips.zip ├── load-bucket.sh └── readme.adoc ├── couchbase-node ├── Dockerfile ├── cluster-cleanup.sh ├── cluster-create.sh ├── configure-cluster-node.sh ├── docker-compose.yml └── readme.adoc ├── couchbase-server ├── Dockerfile ├── configure-node.sh └── readme.adoc ├── couchbase-windows ├── Dockerfile ├── configure-node.sh └── couchbase.ps1 ├── couchbase ├── Dockerfile ├── configure-node.sh ├── docker-compose-master.yml ├── docker-compose-v2.yml ├── docker-compose-worker.yml ├── master-service.yml ├── readme.adoc └── worker-service.yml ├── flent ├── Dockerfile └── Dockerfile.debian ├── hello-world-image └── Dockerfile ├── javaee7-hol └── Dockerfile ├── javaee7-simple-sample └── Dockerfile ├── javaee7-test └── Dockerfile ├── jboss-eap ├── Dockerfile └── readme.adoc ├── jboss-eap7-nosql ├── docker-compose.yml └── readme.adoc ├── kubernetes └── docker-compose.yml ├── liberty-couchbase-javaee7 ├── docker-compose.yml └── readme.adoc ├── minecraft ├── Dockerfile └── readme.asciidoc ├── mysql-data-container ├── Dockerfile └── readme.asciidoc ├── oracle-jdk ├── Dockerfile └── readme.adoc ├── service-rolling-update ├── app1 │ ├── Dockerfile │ └── app │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.jsp ├── app2 │ ├── Dockerfile │ └── app │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.jsp └── readme.adoc ├── wildfly-admin ├── Dockerfile └── README.asciidoc ├── wildfly-centos └── Dockerfile ├── wildfly-compose └── docker-compose.yml ├── wildfly-couchbase-javaee7-network ├── docker-compose.yml └── readme.adoc ├── wildfly-couchbase-javaee7 ├── Dockerfile ├── check-for-bucket.sh ├── couchbase-javaee.war ├── docker-compose.yml └── readme.adoc ├── wildfly-logstash ├── Dockerfile └── logstash-module.sh ├── wildfly-management └── Dockerfile ├── wildfly-mysql-javaee7 ├── Dockerfile ├── README.asciidoc ├── customization │ ├── employees.war │ ├── execute.sh │ └── mysql-connector-java-5.1.31-bin.jar ├── docker-compose.yml └── employees │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── org │ │ └── javaee7 │ │ └── samples │ │ └── employees │ │ ├── Employee.java │ │ ├── EmployeeEndpoint.java │ │ └── MyApplication.java │ ├── resources │ └── META-INF │ │ ├── load.sql │ │ └── persistence.xml │ └── webapp │ └── index.html ├── wildfly-override ├── docker-compose.override.yml └── docker-compose.yml ├── wildfly-ubuntu └── Dockerfile └── wildfly └── Dockerfile /.gitignore: -------------------------------------------------------------------------------- 1 | **/.DS_Store 2 | **/target/ 3 | **/nb-configuration.xml 4 | -------------------------------------------------------------------------------- /README.asciidoc: -------------------------------------------------------------------------------- 1 | # Docker Images 2 | 3 | Bunch of Docker images for fun 4 | 5 | 6 | -------------------------------------------------------------------------------- /consul/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | myconsul: 4 | image: progrium/consul 5 | restart: always 6 | hostname: consul 7 | ports: 8 | - 8500:8500 9 | command: "-server -bootstrap" 10 | -------------------------------------------------------------------------------- /consul/readme.adoc: -------------------------------------------------------------------------------- 1 | = Start Consul Docker Image 2 | 3 | Starting this image on a Docker Swarm cluster shows: 4 | 5 | ```console 6 | consul > docker-compose up -d 7 | Pulling myconsul (progrium/consul:latest)... 8 | swarm-node-01: Pulling progrium/consul:latest... : downloaded 9 | swarm-master: Pulling progrium/consul:latest... : downloaded 10 | swarm-node-02: Pulling progrium/consul:latest... : downloaded 11 | Creating consul_myconsul_1 12 | ``` 13 | 14 | Checkin the status of container: 15 | 16 | ```console 17 | consul > docker ps 18 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 19 | 3e108d01c925 progrium/consul "/bin/start -server -" 5 seconds ago Up 4 seconds 53/tcp, 53/udp, 8300-8302/tcp, 8301-8302/udp, 8400/tcp, 192.168.99.107:8500->8500/tcp swarm-node-01/consul_myconsul_1 20 | ``` 21 | 22 | -------------------------------------------------------------------------------- /couchbase-bucket/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM couchbase 2 | 3 | COPY load-bucket.sh /opt/couchbase 4 | COPY data /opt/couchbase/data 5 | 6 | CMD ["/opt/couchbase/load-bucket.sh"] 7 | 8 | -------------------------------------------------------------------------------- /couchbase-bucket/data/zips.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arun-gupta/docker-images/0659ccc1792c958960537065109ebbd92db92f2c/couchbase-bucket/data/zips.zip -------------------------------------------------------------------------------- /couchbase-bucket/load-bucket.sh: -------------------------------------------------------------------------------- 1 | # Enables job control 2 | set -m 3 | 4 | # Enables error propagation 5 | set -e 6 | 7 | apt-get update 8 | apt-get install -y unzip 9 | 10 | mkdir -p /opt/couchbase/data/docs 11 | cd /opt/couchbase/data 12 | wget http://jsonstudio.com/wp-content/uploads/2014/02/zips.zip 13 | unzip zips.zip 14 | cd docs 15 | split -l 1 -a 4 ../zips.json 16 | for file in * 17 | do 18 | sed -i 's/_id/uuid/g' "$file" 19 | mv "$file" "$file.json" 20 | done 21 | 22 | /entrypoint.sh couchbase-server & 23 | 24 | sleep 15 25 | 26 | curl --fail -v -X POST http://127.0.0.1:8091/pools/default -d memoryQuota=300 -d indexMemoryQuota=300 27 | curl --fail -v http://127.0.0.1:8091/node/controller/setupServices -d services=kv%2Cn1ql%2Cindex 28 | curl --fail -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=Administrator -d password=password 29 | 30 | #Create the bucket 31 | couchbase-cli bucket-create -c 127.0.0.1 --bucket=sample --bucket-ramsize=200 -u Administrator -p password 32 | 33 | #Break the big document into multiple documents 34 | cbdocloader -u Administrator -p password -n 127.0.0.1:8091 -b sample -s 100 /opt/couchbase/data 35 | 36 | fg 1 37 | 38 | -------------------------------------------------------------------------------- /couchbase-bucket/readme.adoc: -------------------------------------------------------------------------------- 1 | = Load a sample bucket in Couchbase 2 | 3 | Build the image (only for dev, otherwise already available in Docker Hub): 4 | 5 | ```console 6 | docker build -t arungupta/couchbase-bucket . 7 | ``` 8 | 9 | This image: 10 | 11 | - Configures a Couchbase node 12 | - Download US zip code JSON sample data from http://jsonstudio.com/resources/ 13 | - Creates multiple documents from this data 14 | - Loads this data in the `sample` bucket 15 | 16 | -------------------------------------------------------------------------------- /couchbase-node/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM couchbase 2 | 3 | COPY configure-cluster-node.sh /opt/couchbase 4 | 5 | CMD ["/opt/couchbase/configure-cluster-node.sh"] 6 | 7 | -------------------------------------------------------------------------------- /couchbase-node/cluster-cleanup.sh: -------------------------------------------------------------------------------- 1 | docker-machine stop consul-machine swarm-master swarm-node-01 swarm-node-02 2 | docker-machine rm consul-machine swarm-master swarm-node-01 swarm-node-02 3 | -------------------------------------------------------------------------------- /couchbase-node/cluster-create.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -x 3 | 4 | # Docker Machine for Consul 5 | docker-machine \ 6 | create \ 7 | -d virtualbox \ 8 | consul-machine 9 | 10 | # Start Consul 11 | docker $(docker-machine config consul-machine) run -d --restart=always \ 12 | -p "8500:8500" \ 13 | -h "consul" \ 14 | progrium/consul -server -bootstrap 15 | 16 | # Docker Swarm master 17 | docker-machine \ 18 | create \ 19 | -d virtualbox \ 20 | --virtualbox-disk-size "5000" \ 21 | --swarm \ 22 | --swarm-master \ 23 | --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" \ 24 | --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" \ 25 | --engine-opt="cluster-advertise=eth1:2376" \ 26 | swarm-master 27 | 28 | # Docker Swarm node-01 29 | docker-machine \ 30 | create \ 31 | -d virtualbox \ 32 | --virtualbox-disk-size "5000" \ 33 | --swarm \ 34 | --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" \ 35 | --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" \ 36 | --engine-opt="cluster-advertise=eth1:2376" \ 37 | swarm-node-01 38 | 39 | # Docker Swarm node-02 40 | docker-machine \ 41 | create \ 42 | -d virtualbox \ 43 | --virtualbox-disk-size "5000" \ 44 | --swarm \ 45 | --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" \ 46 | --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" \ 47 | --engine-opt="cluster-advertise=eth1:2376" \ 48 | swarm-node-02 49 | 50 | # Configure to use Docker Swarm cluster 51 | eval "$(docker-machine env --swarm swarm-master)" 52 | 53 | # Create an overlay network 54 | docker \ 55 | network \ 56 | create \ 57 | -d overlay \ 58 | couchbase-net 59 | 60 | # Swarm will ensure that Couchbase is started on a node where port is available 61 | 62 | # Start three instances of Couchbase 63 | for i in {1..3} 64 | do 65 | docker \ 66 | run \ 67 | -d \ 68 | --net=couchbase-net \ 69 | -p 8091-8093:8091-8093 \ 70 | -p 11210:11210 \ 71 | arungupta/couchbase-node 72 | done 73 | 74 | # Get IP address of the Couchbase containers from Docker Swarm 75 | eval "$(docker-machine env --swarm swarm-master)" 76 | declare -a ip 77 | count=0 78 | # for i in `docker ps -q` 79 | # do 80 | # ip[$count]=`docker inspect --format '{{ index .NetworkSettings.Ports "8091/tcp" 0 "HostIp" }}' $i` 81 | # ((count++)) 82 | # done 83 | 84 | ip[$count]=`docker-machine ssh swarm-master "docker ps | grep couchbase" | awk '{ print $1 }' | xargs docker inspect --format '{{ index .NetworkSettings.Ports "8091/tcp" 0 "HostIp" }}'` 85 | # ip[$count]=$(ipAddress "swarm-master") 86 | ((count++)) 87 | ip[$count]=`docker-machine ssh swarm-node-01 "docker ps | grep couchbase" | awk '{ print $1 }' | xargs docker inspect --format '{{ index .NetworkSettings.Ports "8091/tcp" 0 "HostIp" }}'` 88 | ((count++)) 89 | ip[$count]=`docker-machine ssh swarm-node-02 "docker ps | grep couchbase" | awk '{ print $1 }' | xargs docker inspect --format '{{ index .NetworkSettings.Ports "8091/tcp" 0 "HostIp" }}'` 90 | 91 | echo ${ip[0]} .. ${ip[1]} .. ${ip[2]} 92 | 93 | # Configure Couchbase cluster 94 | # curl -X POST -u Administrator:password http://IP1:8091/controller/addNode -d hostname=IP2 -d user=Administrator -d password=password -d services=kv,n1ql,index -o O1 95 | # {"otpNode":"ns_1@172.17.0.4"} 96 | # curl -X POST -u Administrator:password http://IP1:8091/controller/addNode -d hostname=IP3 -d user=Administrator -d password=password -d services=kv,n1ql,index -o O2 97 | # {"otpNode":"ns_1@172.17.0.5"} 98 | 99 | #curl -X GET -u Administratator:password http://IP1:8091/pools/default 100 | 101 | # # Rebalance the cluster: 102 | # curl -v -X POST -u Administrator:password http://IP1:8091/controller/rebalance --data 'knownNodes=ns_1%40172.17.0.3%2Cns_1%40172.17.0.4 %2Cns_1%40172.17.0.5&ejectedNodes=' 103 | 104 | -------------------------------------------------------------------------------- /couchbase-node/configure-cluster-node.sh: -------------------------------------------------------------------------------- 1 | # Enables job control 2 | set -m 3 | 4 | # Enables error propagation 5 | set -e 6 | 7 | /entrypoint.sh couchbase-server & 8 | 9 | sleep 15 10 | 11 | curl --fail -v -X POST http://127.0.0.1:8091/pools/default -d memoryQuota=300 -d indexMemoryQuota=300 12 | curl --fail -v http://127.0.0.1:8091/node/controller/setupServices -d services=kv%2Cn1ql%2Cindex 13 | curl --fail -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=Administrator -d password=password 14 | 15 | fg 1 16 | 17 | -------------------------------------------------------------------------------- /couchbase-node/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | db: 4 | image: arungupta/couchbase-node 5 | ports: 6 | - 8091-8093:8091-8093 7 | # - 9100-9105:9100-9105 8 | # - 11207:11207 9 | # - 11209-11211:11209-11211 10 | # - 18091-18093:18091-18093 11 | - 11210:11210 12 | - 4369:4369 13 | # - 21100-21299:21100-21299 14 | 15 | networks: 16 | default: 17 | driver: overlay 18 | -------------------------------------------------------------------------------- /couchbase-node/readme.adoc: -------------------------------------------------------------------------------- 1 | = Couchbase Cluster using Docker 2 | 3 | Build the image (only for dev, otherwise already available in Docker Hub): 4 | 5 | ```console 6 | docker build -t arungupta/couchbase-node . 7 | ``` 8 | 9 | == How to setup cluster 10 | 11 | === Start Consul 12 | 13 | . Create a machine for Consul: 14 | 15 | docker-machine create -d=virtualbox consul-machine 16 | 17 | . Connect to this Machine: 18 | 19 | eval $(docker-machine env consul-machine) 20 | 21 | . Use http://github.com/arun-gupta/docker-images/blob/master/consul/docker-compose.yml[Docker Compose for Consul] and start Consul: 22 | 23 | docker-compose up -d 24 | 25 | === Create Docker Swarm Cluster 26 | 27 | . Create master: 28 | 29 | docker-machine create -d virtualbox --virtualbox-disk-size "5000" --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-master 30 | 31 | . Create node-01: 32 | 33 | docker-machine create -d virtualbox --virtualbox-disk-size "5000" --swarm --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-node-01 34 | 35 | . Create node-02: 36 | 37 | docker-machine create -d virtualbox --virtualbox-disk-size "5000" --swarm --swarm-discovery="consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-store=consul://$(docker-machine ip consul-machine):8500" --engine-opt="cluster-advertise=eth1:2376" swarm-node-02 38 | 39 | . Connect to Swarm: 40 | 41 | eval "$(docker-machine env --swarm swarm-master)" 42 | 43 | . Use Compose file from link:docker-compose.yml[], and run three instances of container: 44 | 45 | docker-compose up -d 46 | docker-compose scale db=2 47 | 48 | . Check the Couchbase containers on Swarm: 49 | + 50 | [source, text] 51 | ---- 52 | docker ps 53 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 54 | 08e3af15466f arungupta/couchbase-node "/entrypoint.sh /opt/" 36 seconds ago Up 35 seconds 192.168.99.105:4369->4369/tcp, 192.168.99.105:8091-8093->8091-8093/tcp, 11207/tcp, 11211/tcp, 192.168.99.105:11210->11210/tcp, 18091-18092/tcp swarm-node-02/couchbasenode_db_2 55 | 6b8704a43e99 arungupta/couchbase-node "/entrypoint.sh /opt/" About a minute ago Up About a minute 192.168.99.104:4369->4369/tcp, 192.168.99.104:8091-8093->8091-8093/tcp, 11207/tcp, 11211/tcp, 192.168.99.104:11210->11210/tcp, 18091-18092/tcp swarm-node-01/couchbasenode_db_1 56 | ---- 57 | + 58 | . Get IP address of all the Machines: 59 | 60 | docker inspect --format '{{ .Node.IP }}' $(docker ps -q) 61 | 62 | . Create the cluster: 63 | 64 | curl -X POST -u Administrator:password http://192.168.99.104:8091/controller/addNode -d hostname=192.168.99.105 -d user=Administrator -d password=password -d services=kv,n1ql,index 65 | {"otpNode":"ns_1@172.17.0.4"} 66 | 67 | BROKEN HERE 68 | 69 | . Rebalance the cluster: 70 | + 71 | [source, text] 72 | ---- 73 | curl -v -X POST -u Administrator:password http://172.17.0.3:8091/controller/rebalance --data 'knownNodes=ns_1%40172.17.0.3%2Cns_1%40172.17.0.4 %2Cns_1%40172.17.0.5&ejectedNodes=' 74 | * About to connect() to 172.17.0.3 port 8091 (#0) 75 | * Trying 172.17.0.3... 76 | * Adding handle: conn: 0xb213c0 77 | * Adding handle: send: 0 78 | * Adding handle: recv: 0 79 | * Curl_addHandleToPipeline: length: 1 80 | * - Conn 0 (0xb213c0) send_pipe: 1, recv_pipe: 0 81 | * Connected to 172.17.0.3 (172.17.0.3) port 8091 (#0) 82 | * Server auth using Basic with user 'Administrator' 83 | > POST /controller/rebalance HTTP/1.1 84 | > Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA== 85 | > User-Agent: curl/7.33.0 86 | > Host: 172.17.0.3:8091 87 | > Accept: */* 88 | > Content-Length: 82 89 | > Content-Type: application/x-www-form-urlencoded 90 | > 91 | * upload completely sent off: 82 out of 82 bytes 92 | < HTTP/1.1 200 OK 93 | * Server Couchbase Server is not blacklisted 94 | < Server: Couchbase Server 95 | < Pragma: no-cache 96 | < Date: Tue, 22 Dec 2015 00:32:38 GMT 97 | < Content-Length: 0 98 | < Cache-Control: no-cache 99 | < 100 | * Connection #0 to host 172.17.0.3 left intact 101 | ---- 102 | 103 | Questions: 104 | 105 | . 8091 and 8093 ports need to be exposed in order for the application to access the cluster. It can be from one container, ideally all of them. What do you recommend so that there is no port conflict? 106 | . How do I ensure that only one instance of Couchbase container is started on Docker Swarm node? Scheduling strategy? 107 | . Are there any pre/post scripts that can be automatically run after Compose scaling? Otherwise scaling would always require manual script invocation. 108 | . How do other databases scale, e.g. MySQL? Any existing recipes? 109 | 110 | 111 | -------------------------------------------------------------------------------- /couchbase-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM couchbase/server:enterprise-4.5.0-DP1 2 | 3 | COPY configure-node.sh /opt/couchbase 4 | 5 | CMD ["/opt/couchbase/configure-node.sh"] 6 | 7 | -------------------------------------------------------------------------------- /couchbase-server/configure-node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -m 4 | 5 | /entrypoint.sh couchbase-server & 6 | 7 | sleep 15 8 | 9 | curl -v -X POST http://127.0.0.1:8091/pools/default -d memoryQuota=256 -d indexMemoryQuota=256 -d ftsMemoryQuota=256 10 | curl -v http://127.0.0.1:8091/node/controller/setupServices -d services=kv%2Cn1ql%2Cindex%2Cfts 11 | curl -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=Administrator -d password=password 12 | curl -v -u Administrator:password -X POST http://127.0.0.1:8091/sampleBuckets/install -d '["travel-sample"]' 13 | 14 | fg 1 15 | -------------------------------------------------------------------------------- /couchbase-server/readme.adoc: -------------------------------------------------------------------------------- 1 | = Couchbase Docker Container 2 | 3 | == Run Container 4 | 5 | docker run -d -p 8091-8093:8091-8093 -p 11210:11210 arungupta/couchbase-server 6 | 7 | == Build Image 8 | 9 | docker build -t arungupta/couchbase-server . -------------------------------------------------------------------------------- /couchbase-windows/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/windowsservercore 2 | 3 | RUN powershell -Command couchbase.ps1 4 | 5 | #WORKDIR C:\\Couchbase\\Server\\bin 6 | 7 | #RUN powershell -Command Start-Sleep -Seconds 120; \ 8 | # service_stop.bat 9 | 10 | #CMD ["service_start.bat"] 11 | -------------------------------------------------------------------------------- /couchbase-windows/configure-node.sh: -------------------------------------------------------------------------------- 1 | set -m 2 | 3 | /entrypoint.sh couchbase-server & 4 | 5 | sleep 15 6 | 7 | curl -v -X POST http://127.0.0.1:8091/pools/default -d memoryQuota=300 -d indexMemoryQuota=300 8 | curl -v http://127.0.0.1:8091/node/controller/setupServices -d services=kv%2Cn1ql%2Cindex 9 | curl -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=Administrator -d password=password 10 | curl -v -u Administrator:password -X POST http://127.0.0.1:8091/sampleBuckets/install -d '["travel-sample"]' 11 | 12 | echo "Type: $TYPE, Master: $COUCHBASE_MASTER" 13 | 14 | if [ "$TYPE" = "worker" ]; then 15 | sleep 15 16 | set IP=`hostname -I` 17 | couchbase-cli server-add --cluster=$COUCHBASE_MASTER:8091 --user Administrator --password password --server-add=$IP 18 | # TODO: Hack with the cuts, use jq may be better. 19 | #KNOWN_NODES=`curl -X POST -u Administrator:password http://$COUCHBASE_MASTER:8091/controller/addNode \ 20 | # -d hostname=$IP -d user=Administrator -d password=password -d services=kv,n1ql,index | cut -d: -f2 | cut -d\" -f 2 | sed -e 's/@/%40/g'` 21 | 22 | if [ "$AUTO_REBALANCE" = "true" ]; then 23 | echo "Auto Rebalance: $AUTO_REBALANCE" 24 | sleep 10 25 | couchbase-cli rebalance -c $COUCHBASE_MASTER:8091 -u Administrator -p password --server-add=$IP 26 | #curl -v -X POST -u Administrator:password http://$COUCHBASE_MASTER:8091/controller/rebalance --data "knownNodes=$KNOWN_NODES&ejectedNodes=" 27 | fi; 28 | fi; 29 | 30 | fg 1 31 | 32 | -------------------------------------------------------------------------------- /couchbase-windows/couchbase.ps1: -------------------------------------------------------------------------------- 1 | #Install Chocolatey package manager 2 | iex (wget 'https://chocolatey.org/install.ps1' -UseBasicParsing) 3 | 4 | #Install Couchbase 5 | choco install -y --allow-empty-checksums couchbase-server-community 6 | 7 | -------------------------------------------------------------------------------- /couchbase/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM couchbase:latest 2 | 3 | COPY configure-node.sh /opt/couchbase 4 | 5 | #HEALTHCHECK --interval=5s --timeout=3s CMD curl --fail http://localhost:8091/pools || exit 1 6 | 7 | CMD ["/opt/couchbase/configure-node.sh"] 8 | 9 | -------------------------------------------------------------------------------- /couchbase/configure-node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | set -m 5 | 6 | /entrypoint.sh couchbase-server & 7 | 8 | sleep 15 9 | 10 | # Setup index and memory quota 11 | curl -v -X POST http://127.0.0.1:8091/pools/default -d memoryQuota=300 -d indexMemoryQuota=300 12 | 13 | # Setup services 14 | curl -v http://127.0.0.1:8091/node/controller/setupServices -d services=kv%2Cn1ql%2Cindex 15 | 16 | # Setup credentials 17 | curl -v http://127.0.0.1:8091/settings/web -d port=8091 -d username=Administrator -d password=password 18 | 19 | # Setup Memory Optimized Indexes 20 | curl -i -u Administrator:password -X POST http://127.0.0.1:8091/settings/indexes -d 'storageMode=memory_optimized' 21 | 22 | # Load travel-sample bucket 23 | #curl -v -u Administrator:password -X POST http://127.0.0.1:8091/sampleBuckets/install -d '["travel-sample"]' 24 | 25 | echo "Type: $TYPE" 26 | 27 | if [ "$TYPE" = "WORKER" ]; then 28 | echo "Sleeping ..." 29 | sleep 15 30 | 31 | #IP=`hostname -s` 32 | IP=`hostname -I | cut -d ' ' -f1` 33 | echo "IP: " $IP 34 | 35 | echo "Auto Rebalance: $AUTO_REBALANCE" 36 | if [ "$AUTO_REBALANCE" = "true" ]; then 37 | couchbase-cli rebalance --cluster=$COUCHBASE_MASTER:8091 --user=Administrator --password=password --server-add=$IP --server-add-username=Administrator --server-add-password=password 38 | else 39 | couchbase-cli server-add --cluster=$COUCHBASE_MASTER:8091 --user=Administrator --password=password --server-add=$IP --server-add-username=Administrator --server-add-password=password 40 | fi; 41 | fi; 42 | 43 | fg 1 44 | -------------------------------------------------------------------------------- /couchbase/docker-compose-master.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | master: 4 | image: arungupta/couchbase 5 | deploy: 6 | replicas: 1 7 | ports: 8 | - 8091:8091 9 | environment: 10 | TYPE: "MASTER" 11 | networks: 12 | - couchbase 13 | networks: 14 | couchbase: 15 | driver: overlay -------------------------------------------------------------------------------- /couchbase/docker-compose-v2.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | services: 3 | db: 4 | image: arungupta/couchbase 5 | ports: 6 | - 8091:8091 7 | - 8092:8092 8 | - 8093:8093 9 | - 11210:11210 10 | -------------------------------------------------------------------------------- /couchbase/docker-compose-worker.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | worker: 4 | image: arungupta/couchbase 5 | deploy: 6 | replicas: 1 7 | environment: 8 | TYPE: "WORKER" 9 | COUCHBASE_MASTER: "couchbase-master_master.couchbase-master_couchbase" 10 | AUTO_REBALANCE: "false" 11 | networks: 12 | default: 13 | external: 14 | name: couchbase-master_couchbase 15 | -------------------------------------------------------------------------------- /couchbase/master-service.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ReplicationController 3 | metadata: 4 | name: couchbase-controller 5 | spec: 6 | replicas: 1 7 | selector: 8 | app: couchbase-master-pod 9 | template: 10 | metadata: 11 | labels: 12 | app: couchbase-master-pod 13 | spec: 14 | containers: 15 | - name: couchbase-master 16 | image: arungupta/couchbase 17 | env: 18 | - name: TYPE 19 | value: MASTER 20 | ports: 21 | - containerPort: 8091 22 | ---- 23 | apiVersion: v1 24 | kind: Service 25 | metadata: 26 | name: couchbase-service 27 | labels: 28 | app: couchbase-master-service 29 | spec: 30 | ports: 31 | - port: 8091 32 | selector: 33 | app: couchbase-master-pod -------------------------------------------------------------------------------- /couchbase/readme.adoc: -------------------------------------------------------------------------------- 1 | = Couchbase Docker Image 2 | 3 | This directory shows how to build a custom Couchbase Docker image that: 4 | 5 | . Setups memory for Index and Data 6 | . Configures the Couchbase server with Index, Data, and Query service 7 | . Sets up username and password credentials 8 | 9 | == Build the Image 10 | 11 | ```console 12 | docker build -t arungupta/couchbase . 13 | ``` 14 | 15 | == Run the Container 16 | 17 | ``` 18 | docker-compose up -d 19 | ``` 20 | 21 | == Cluster using Docker Services 22 | 23 | . Create network: 24 | + 25 | ``` 26 | docker network create \ 27 | -d overlay \ 28 | couchbase 29 | ``` 30 | + 31 | . Create master: 32 | + 33 | ``` 34 | docker service create \ 35 | --name couchbase-master \ 36 | --replicas 1 \ 37 | -p 8091:8091 \ 38 | --network couchbase \ 39 | -e TYPE=MASTER \ 40 | arungupta/couchbase 41 | ``` 42 | + 43 | . Create worker 44 | + 45 | ``` 46 | docker service create \ 47 | --name couchbase-worker \ 48 | --replicas 1 \ 49 | --network couchbase \ 50 | -e TYPE=WORKER \ 51 | -e COUCHBASE_MASTER=couchbase-master.couchbase \ 52 | -e AUTO_REBALANCE=false \ 53 | arungupta/couchbase 54 | ``` 55 | + 56 | . Scale cluster 57 | + 58 | ``` 59 | docker service scale couchbase-worker=2 60 | ``` 61 | 62 | == Cluster using Kubernetes 63 | 64 | . Create Master RC 65 | + 66 | ``` 67 | kubectl.sh create -f master-service.yml 68 | ``` 69 | + 70 | . Create Worker RC 71 | + 72 | ``` 73 | kubectl.sh create -f worker-service.yml 74 | ``` 75 | + 76 | . Scale cluster 77 | + 78 | ``` 79 | kubectl.sh scale --replicas=3 -f worker-service.yml 80 | ``` 81 | 82 | -------------------------------------------------------------------------------- /couchbase/worker-service.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ReplicationController 3 | metadata: 4 | name: couchbase-controller 5 | spec: 6 | replicas: 1 7 | selector: 8 | app: couchbase-worker-pod 9 | template: 10 | metadata: 11 | labels: 12 | app: couchbase-worker-pod 13 | spec: 14 | containers: 15 | - name: couchbase-worker 16 | image: arungupta/couchbase 17 | env: 18 | - name: TYPE 19 | value: WORKER 20 | - name: COUCHBASE_MASTER 21 | value: SERVICE_IP_OF_MASTER 22 | - name: AUTO_REBALANCE 23 | value: true 24 | ports: 25 | - containerPort: 8091 26 | ---- 27 | apiVersion: v1 28 | kind: Service 29 | metadata: 30 | name: couchbase-service 31 | labels: 32 | app: couchbase-worker-service 33 | spec: 34 | ports: 35 | - port: 8091 36 | selector: 37 | app: couchbase-worker-pod -------------------------------------------------------------------------------- /flent/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:xenial 2 | 3 | RUN apt-get update && apt-get install -y sudo && sudo apt-get install -y software-properties-common 4 | 5 | RUN sudo add-apt-repository ppa:tohojo/flent 6 | RUN sudo apt-get update 7 | 8 | -------------------------------------------------------------------------------- /flent/Dockerfile.debian: -------------------------------------------------------------------------------- 1 | FROM debian:stretch 2 | 3 | RUN apt-get update && apt-get install -y sudo 4 | 5 | RUN apt install -y flent 6 | 7 | CMD flent 8 | -------------------------------------------------------------------------------- /hello-world-image/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | 3 | CMD ["/bin/echo", "hello world"] 4 | -------------------------------------------------------------------------------- /javaee7-hol/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jboss/wildfly 2 | MAINTAINER Arun Gupta 3 | 4 | CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-c", "standalone-full.xml", "-b", "0.0.0.0"] 5 | 6 | RUN curl -L https://github.com/javaee-samples/javaee7-hol/raw/master/solution/movieplex7-1.0-SNAPSHOT.war -o /opt/jboss/wildfly/standalone/deployments/movieplex7-1.0-SNAPSHOT.war 7 | 8 | -------------------------------------------------------------------------------- /javaee7-simple-sample/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jboss/wildfly 2 | MAINTAINER Arun Gupta 3 | 4 | CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-c", "standalone-full.xml", "-b", "0.0.0.0"] 5 | 6 | RUN curl -L https://github.com/javaee-samples/javaee7-simple-sample/releases/download/v1.10/javaee7-simple-sample-1.10.war -o /opt/jboss/wildfly/standalone/deployments/javaee7-simple-sample.war 7 | 8 | -------------------------------------------------------------------------------- /javaee7-test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM arungupta/wildfly-centos 2 | 3 | ADD jaxrs/jaxrs-client/target/jaxrs-client.war /opt/wildfly/standalone/deployments/ 4 | 5 | -------------------------------------------------------------------------------- /jboss-eap/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use latest jboss/base-jdk:8 image as the base 2 | FROM jboss/base-jdk:8 3 | 4 | # Set the JBOSS_VERSION env variable 5 | ENV JBOSS_VERSION 7.0.0.Beta 6 | ENV JBOSS_HOME /opt/jboss/jboss-eap-7.0/ 7 | 8 | COPY jboss-eap-$JBOSS_VERSION.zip $HOME 9 | 10 | # Add the JBoss distribution to /opt, and make jboss the owner of the extracted zip content 11 | # Make sure the distribution is available from a well-known place 12 | RUN cd $HOME \ 13 | && unzip jboss-eap-$JBOSS_VERSION.zip \ 14 | && rm jboss-eap-$JBOSS_VERSION.zip 15 | 16 | # Ensure signals are forwarded to the JVM process correctly for graceful shutdown 17 | ENV LAUNCH_JBOSS_IN_BACKGROUND true 18 | 19 | # Add a user in administration realm 20 | RUN /opt/jboss/jboss-eap-7.0/bin/add-user.sh admin Admin#007 --silent 21 | 22 | # Expose the ports we're interested in 23 | EXPOSE 8080 9990 24 | 25 | # Set the default command to run on boot 26 | # This will boot JBoss EAP in the standalone mode and bind to all interface 27 | CMD ["/opt/jboss/jboss-eap-7.0/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] 28 | 29 | -------------------------------------------------------------------------------- /jboss-eap/readme.adoc: -------------------------------------------------------------------------------- 1 | = JBoss EAP 7 Docker Image 2 | 3 | There is no publicly accessible Docker image for JBoss EAP 7. This workspace shows how to create your own Docker image for JBoss EAP 7. 4 | 5 | == Build the Image 6 | 7 | Before you can build the image, download JBoss EAP 7 from http://www.jboss.org/products/eap/download/ in this directory. 8 | 9 | ``` 10 | docker build -t arungupta/jboss-eap:7-beta . 11 | ``` 12 | 13 | A user is added in the admin realm with the following credentials: 14 | 15 | Name: `admin` 16 | Password: `Admin#007` 17 | 18 | == Run the Image 19 | 20 | ``` 21 | docker run -it -p 8080:8080 arungupta/jboss-eap:7-beta 22 | ``` -------------------------------------------------------------------------------- /jboss-eap7-nosql/docker-compose.yml: -------------------------------------------------------------------------------- 1 | mycouchbase: 2 | container_name: "db" 3 | image: couchbase/server 4 | ports: 5 | - 8091:8091 6 | - 8092:8092 7 | - 8093:8093 8 | - 11210:11210 9 | jboss: 10 | image: arungupta/jboss-eap:7-beta 11 | environment: 12 | - COUCHBASE_URI=db 13 | ports: 14 | - 8080:8080 15 | - 9990:9990 16 | -------------------------------------------------------------------------------- /jboss-eap7-nosql/readme.adoc: -------------------------------------------------------------------------------- 1 | = Java EE 7 sample with JBoss EAP and NoSQL 2 | 3 | Instructions at https://github.com/arun-gupta/couchbase-javaee. 4 | -------------------------------------------------------------------------------- /kubernetes/docker-compose.yml: -------------------------------------------------------------------------------- 1 | etcd: 2 | image: gcr.io/google_containers/etcd:2.0.9 3 | net: "host" 4 | command: /usr/local/bin/etcd --addr=127.0.0.1:4001 --bind-addr=0.0.0.0:4001 --data-dir=/var/etcd/data 5 | master: 6 | image: gcr.io/google_containers/hyperkube:v0.21.2 7 | net: "host" 8 | volumes: 9 | - /var/run/docker.sock:/var/run/docker.sock 10 | command: /hyperkube kubelet --api_servers=http://localhost:8080 --v=2 --address=0.0.0.0 --enable_server --hostname_override=127.0.0.1 --config=/etc/kubernetes/manifests --cluster-dns=10.0.2.15 --cluster-domain=kubernetes.local 11 | proxy: 12 | image: gcr.io/google_containers/hyperkube:v0.21.2 13 | net: "host" 14 | privileged: true 15 | command: /hyperkube proxy --master=http://127.0.0.1:8080 --v=2 16 | kube2sky: 17 | image: gcr.io/google_containers/kube2sky:1.11 18 | net: "host" 19 | privileged: true 20 | command: -v=10 -logtostderr=true -domain=kubernetes.local -etcd-server="http://127.0.0.1:4001" 21 | skydns: 22 | image: gcr.io/google_containers/skydns:2015-03-11-001 23 | net: "host" 24 | environment: 25 | SKYDNS_DOMAIN: 'kubernetes.local' 26 | SKYDNS_ADDR: '0.0.0.0:53' 27 | SKYDNS_NAMESERVERS: '8.8.8.8:53,8.8.4.4:53' 28 | ETCD_MACHINES: 'http://127.0.0.1:4001' -------------------------------------------------------------------------------- /liberty-couchbase-javaee7/docker-compose.yml: -------------------------------------------------------------------------------- 1 | mycouchbase: 2 | container_name: "db" 3 | image: couchbase/server 4 | ports: 5 | - 8091:8091 6 | - 8092:8092 7 | - 8093:8093 8 | - 11210:11210 9 | mywildfly: 10 | image: websphere-liberty 11 | environment: 12 | - LICENSE=accept 13 | ports: 14 | - 80:9080 15 | -------------------------------------------------------------------------------- /liberty-couchbase-javaee7/readme.adoc: -------------------------------------------------------------------------------- 1 | = Java EE 7 sample with Liberty Profile and Couchbase 2 | 3 | Instructions at https://github.com/arun-gupta/couchbase-javaee. 4 | -------------------------------------------------------------------------------- /minecraft/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:8 2 | MAINTAINER Arun Gupta 3 | 4 | EXPOSE 25565 ?? 5 | 6 | EXPOSE 2376 ?? 7 | 8 | RUN wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar 9 | 10 | # Generate spigot-1.8.jar 11 | RUN ["java", "-Xmx1024m", "-jar", "BuildTools.jar", "--rev", "1.8"] 12 | 13 | # Run the server once to generate eula.txt 14 | RUN ["java", "-Xmx1024m", "-jar", "spigot-1.8.jar"] 15 | 16 | # Set eula=true so that server can start successfully 17 | RUN ["echo", "eula", "=", $EULA, ">>", "eula.txt"] 18 | 19 | # Fire the server 20 | CMD ["java", "-Xmx1024m", "-jar", "spigot-1.8.jar"] 21 | -------------------------------------------------------------------------------- /minecraft/readme.asciidoc: -------------------------------------------------------------------------------- 1 | # Minecraft Docker Container 2 | 3 | . Run the server as: 4 | + 5 | [source,text] 6 | ---- 7 | docker run -it -p 25565:25565 -e EULA=true arungupta/minecraft 8 | ---- 9 | 10 | ## TODO 11 | 12 | . Where is the data directory? 13 | . Can `spigot-1.8.jar` be generated only once, and used subsequently? -------------------------------------------------------------------------------- /mysql-data-container/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mysql:latest 2 | 3 | VOLUME /var/lib/mysql 4 | 5 | CMD ["true"] 6 | -------------------------------------------------------------------------------- /mysql-data-container/readme.asciidoc: -------------------------------------------------------------------------------- 1 | # MySQL Data-only Docker Container 2 | 3 | This image is used to create a data-only container for MySQL. 4 | 5 | . Start the data-only container as: 6 | + 7 | [source, text] 8 | ---- 9 | docker create --name mysql_data arungupta/mysql-data-container 10 | ---- 11 | + 12 | Running these data-only containers is purely optional, although it does not hurt. 13 | + 14 | . Start the MySQL container as: 15 | + 16 | [source, text] 17 | ---- 18 | docker run --volumes-from mysql_data --name mysqldb -e MYSQL_USER=mysql -e MYSQL_PASSWORD=mysql -e MYSQL_DATABASE=sample -e MYSQL_ROOT_PASSWORD=supersecret -d mysql 19 | ---- 20 | + 21 | The important switch here is `--volumes-from`, that allows the MySQL container to use volumes from a data-only container. 22 | 23 | That's it! -------------------------------------------------------------------------------- /oracle-jdk/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | 3 | RUN apt-get update 4 | 5 | RUN mkdir -p /usr/java 6 | 7 | COPY jdk1.8.0_112 /usr/java/jdk1.8.0_112 8 | 9 | ENV JAVA_HOME=/usr/java/jdk1.8.0_112 10 | 11 | ENV PATH=$JAVA_HOME/bin:$PATH 12 | 13 | -------------------------------------------------------------------------------- /oracle-jdk/readme.adoc: -------------------------------------------------------------------------------- 1 | = Docker image using Oracle JDK 2 | 3 | . Download http://www.oracle.com/technetwork/java/javase/downloads/index.html[Oracle JDK] (Linux x64) and extract in this directory 4 | . Build the image as `docker build -t arungupta/jdk .` 5 | -------------------------------------------------------------------------------- /service-rolling-update/app1/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jboss/wildfly 2 | 3 | COPY app/target/app.war /opt/jboss/wildfly/standalone/deployments/app.war 4 | 5 | -------------------------------------------------------------------------------- /service-rolling-update/app1/app/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.example 5 | app 6 | war 7 | 1.0-SNAPSHOT 8 | app Maven Webapp 9 | http://maven.apache.org 10 | 11 | 12 | junit 13 | junit 14 | 3.8.1 15 | test 16 | 17 | 18 | 19 | app 20 | 21 | 22 | -------------------------------------------------------------------------------- /service-rolling-update/app1/app/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Archetype Created Web Application 7 | 8 | -------------------------------------------------------------------------------- /service-rolling-update/app1/app/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Simple Web Application - v1

4 | 5 | 6 | 7 | 8 |
Timestamp <% out.print(new java.util.Date()); %>
Local address <%= request.getLocalAddr() %>
Host name <% out.print(System.getenv("HOSTNAME")); %>
9 | 10 | 11 | -------------------------------------------------------------------------------- /service-rolling-update/app2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jboss/wildfly 2 | 3 | COPY app/target/app.war /opt/jboss/wildfly/standalone/deployments/app.war 4 | 5 | -------------------------------------------------------------------------------- /service-rolling-update/app2/app/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.example 5 | app 6 | war 7 | 1.0-SNAPSHOT 8 | app Maven Webapp 9 | http://maven.apache.org 10 | 11 | 12 | junit 13 | junit 14 | 3.8.1 15 | test 16 | 17 | 18 | 19 | app 20 | 21 | 22 | -------------------------------------------------------------------------------- /service-rolling-update/app2/app/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Archetype Created Web Application 7 | 8 | -------------------------------------------------------------------------------- /service-rolling-update/app2/app/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Simple Web Application - v2

4 | 5 | 6 | 7 | 8 |
Timestamp <% out.print(new java.util.Date()); %>
Local address <%= request.getLocalAddr() %>
Host name <% out.print(System.getenv("HOSTNAME")); %>
9 | 10 | 11 | -------------------------------------------------------------------------------- /service-rolling-update/readme.adoc: -------------------------------------------------------------------------------- 1 | = Two simple web applications for rolling updates 2 | 3 | . Create first image: `docker build -t arungupta/wildfly-app:1 app1` 4 | . Create second image: `docker build -t arungupta/wildfly-app:2 app2` 5 | 6 | -------------------------------------------------------------------------------- /wildfly-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jboss/wildfly:latest 2 | 3 | RUN /opt/jboss/wildfly/bin/add-user.sh admin Admin#007 --silent 4 | 5 | CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] 6 | -------------------------------------------------------------------------------- /wildfly-admin/README.asciidoc: -------------------------------------------------------------------------------- 1 | = Exposing WildFly Admin Console in Docker image 2 | 3 | . Run container and bind application and management ports to all network interfaces as shown: 4 | + 5 | [source,text] 6 | ---- 7 | docker run -P -d jboss/wildfly /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0 8 | ---- 9 | + 10 | . The `-P` flag map any network ports inside the image it to a random high port from the range 49153 to 65535 on Docker host. Exact port can be verified by giving `docker ps` command as shown: 11 | + 12 | [source, text] 13 | ---- 14 | docker ps 15 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 16 | f21dba8846bc jboss/wildfly:latest "/opt/jboss/wildfly/ 10 minutes ago Up 4 minutes 0.0.0.0:49161->8080/tcp, 0.0.0.0:49162->9990/tcp desperate_sammet 17 | ---- 18 | + 19 | Port `8080` is mapped to `49161` and port `9990` is mapped to `49162`. 20 | . Verify your IP using `bootdocker ip` and access the default web page and admin console on these ports. 21 | . WildFly require a user in administration realm before admin console can be accessed. This require a Dockerfile to be created which would create that user. Since we are creating a new Dockerfile, we have two options: 22 | + 23 | .. Just create the user and bind network interfaces on command-line 24 | .. Create the user and override CMD to bind all network interfaces. This will keep command-line simple. 25 | + 26 | We'll use the second option here with https://github.com/arun-gupta/docker-images/blob/master/wildfly-admin/Dockerfile[this Dockerfile]. 27 | . You don't need to build this image though, it is already available as a pre-built image on Docker Hub. Just run it: 28 | + 29 | [source, text] 30 | ---- 31 | docker run -P -d arungupta/wildfly-admin 32 | ---- 33 | + 34 | . Check the mapped ports using `docker ps`. Access the admin console at the mapped port and use ``admin'' username and ``Admin#007'' password. 35 | -------------------------------------------------------------------------------- /wildfly-centos/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos 2 | MAINTAINER Arun Gupta 3 | 4 | # Execute system update 5 | RUN yum -y update && yum clean all 6 | 7 | # Install packages necessary to run EAP 8 | RUN yum -y install xmlstarlet saxon augeas bsdtar unzip && yum clean all 9 | 10 | # Create a user and group used to launch processes 11 | # The user ID 1000 is the default for the first "regular" user on Fedora/RHEL, 12 | # so there is a high chance that this ID will be equal to the current user 13 | # making it easier to use volumes (no permission issues) 14 | RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss 15 | 16 | # Set the working directory to jboss' user home directory 17 | WORKDIR /opt/jboss 18 | 19 | # User root user to install software 20 | USER root 21 | 22 | # Install necessary packages 23 | RUN yum -y install java-1.7.0-openjdk-devel && yum clean all 24 | #RUN yum -y install java-1.8.0-openjdk-devel && yum clean all 25 | 26 | # Switch back to jboss user 27 | USER jboss 28 | 29 | # Set the JAVA_HOME variable to make it clear where Java is located 30 | ENV JAVA_HOME /usr/lib/jvm/java 31 | 32 | # Set the WILDFLY_VERSION env variable 33 | ENV WILDFLY_VERSION 8.2.0.Final 34 | 35 | # Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content 36 | # Make sure the distribution is available from a well-known place 37 | RUN cd $HOME && curl -O http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip && unzip wildfly-$WILDFLY_VERSION.zip && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly && rm wildfly-$WILDFLY_VERSION.zip 38 | 39 | # Set the JBOSS_HOME env variable 40 | ENV JBOSS_HOME /opt/jboss/wildfly 41 | 42 | # Expose the ports we're interested in 43 | EXPOSE 8080 9990 44 | 45 | # Set the default command to run on boot 46 | # This will boot WildFly in the standalone mode and bind to all interface 47 | CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-c", "standalone-full.xml", "-b", "0.0.0.0"] 48 | -------------------------------------------------------------------------------- /wildfly-compose/docker-compose.yml: -------------------------------------------------------------------------------- 1 | mywildfly: 2 | image: jboss/wildfly 3 | volumes: 4 | - ~/deployments/:/opt/jboss/wildfly/standalone/deployments/:rw 5 | ports: 6 | - 8080:8080 7 | -------------------------------------------------------------------------------- /wildfly-couchbase-javaee7-network/docker-compose.yml: -------------------------------------------------------------------------------- 1 | mycouchbase: 2 | container_name: "db" 3 | image: couchbase/server 4 | ports: 5 | - 8091:8091 6 | - 8092:8092 7 | - 8093:8093 8 | - 11210:11210 9 | net: ${NETWORK} 10 | mywildfly: 11 | image: arungupta/wildfly-admin 12 | environment: 13 | - COUCHBASE_URI=db 14 | ports: 15 | - 8080:8080 16 | - 9990:9990 17 | net: ${NETWORK} 18 | -------------------------------------------------------------------------------- /wildfly-couchbase-javaee7-network/readme.adoc: -------------------------------------------------------------------------------- 1 | = Java EE 7 sample with WildFly and Couchbase 2 | 3 | == Create a network 4 | 5 | ``` 6 | docker network create -d bridge mynet 7 | ``` 8 | 9 | Instructions at https://github.com/arun-gupta/couchbase-javaee. 10 | 11 | Start the application as: 12 | 13 | ``` 14 | NETWORK=mynet docker-compose up -d 15 | ``` 16 | 17 | 18 | -------------------------------------------------------------------------------- /wildfly-couchbase-javaee7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jboss/wildfly:latest 2 | 3 | RUN sudo yum install -y jq 4 | 5 | COPY check-for-bucket.sh /opt/jboss/wildfly/check-for-bucket.sh 6 | 7 | RUN /opt/jboss/wildfly/check-for-bucket.sh 8 | 9 | COPY couchbase-javaee.war /opt/jboss/wildfly/standalone/deployments/airlines.war 10 | 11 | -------------------------------------------------------------------------------- /wildfly-couchbase-javaee7/check-for-bucket.sh: -------------------------------------------------------------------------------- 1 | cmd=`curl -u Administrator:password http://${COUCHBASE_URI}:8091/pools/default/buckets/travel-sample 2>/dev/null | jq .basicStats.itemCount` 2 | 3 | while [ -z $cmd ]; do 4 | cmd=`curl -u Administrator:password http://${COUCHBASE_URI}:8091/pools/default/buckets/travel-sample 2>/dev/null | jq .basicStats.itemCount` 5 | echo "(" `date` ") Waiting (1) ... value=$cmd" 6 | sleep 1 7 | done 8 | 9 | while [ $cmd -ne "31569" ]; do 10 | cmd=`curl -u Administrator:password http://${COUCHBASE_URI}:8091/pools/default/buckets/travel-sample 2>/dev/null | jq .basicStats.itemCount` 11 | echo "(" `date` ") Waiting (2) ... value=$cmd" 12 | sleep 2 13 | done 14 | 15 | echo "Completed: $cmd records found" 16 | 17 | -------------------------------------------------------------------------------- /wildfly-couchbase-javaee7/couchbase-javaee.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arun-gupta/docker-images/0659ccc1792c958960537065109ebbd92db92f2c/wildfly-couchbase-javaee7/couchbase-javaee.war -------------------------------------------------------------------------------- /wildfly-couchbase-javaee7/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | db: 4 | image: arungupta/couchbase:travel 5 | ports: 6 | - 8091:8091 7 | - 8092:8092 8 | - 8093:8093 9 | - 11210:11210 10 | web: 11 | image: arungupta/wildfly-couchbase-javaee:travel 12 | environment: 13 | - COUCHBASE_URI=db 14 | ports: 15 | - 8080:8080 16 | - 9990:9990 17 | -------------------------------------------------------------------------------- /wildfly-couchbase-javaee7/readme.adoc: -------------------------------------------------------------------------------- 1 | = Java EE 7 sample with WildFly and Couchbase 2 | 3 | Instructions at https://github.com/arun-gupta/couchbase-javaee. 4 | -------------------------------------------------------------------------------- /wildfly-logstash/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jboss/wildfly:9.0.1.Final 2 | 3 | RUN curl -L https://repository.jboss.org/nexus/service/local/repositories/releases/content/org/jboss/logmanager/jboss-logmanager-ext/1.0.0.Alpha3/jboss-logmanager-ext-1.0.0.Alpha3.jar -o /opt/jboss/wildfly/jboss-logmanager-ext-1.0.0.Alpha3.jar 4 | 5 | ADD logstash-module.sh /opt/jboss/wildfly/logstash-module.sh 6 | 7 | CMD ["/opt/jboss/wildfly/logstash-module.sh"] 8 | -------------------------------------------------------------------------------- /wildfly-logstash/logstash-module.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JBOSS_HOME=/opt/jboss/wildfly 4 | JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh 5 | 6 | function wait_for_server() { 7 | until `$JBOSS_CLI -c ":read-attribute(name=server-state)" 2> /dev/null | grep -q running`; do 8 | sleep 1 9 | done 10 | } 11 | 12 | echo "=> Starting WildFly server" 13 | $JBOSS_HOME/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0 --admin-only & 14 | 15 | echo "=> Waiting for the server to boot" 16 | wait_for_server 17 | 18 | $JBOSS_CLI -c << EOF 19 | 20 | batch 21 | # Add the module, replace the directory on the resources attribute to the path where you downloaded the jboss-logmanager-ext library 22 | module add --name=org.jboss.logmanager.ext --dependencies=org.jboss.logmanager,javax.json.api,javax.xml.stream.api --resources=/opt/jboss/wildfly/jboss-logmanager-ext-1.0.0.Alpha3.jar 23 | 24 | # Add the logstash formatter 25 | /subsystem=logging/custom-formatter=logstash:add(class=org.jboss.logmanager.ext.formatters.LogstashFormatter,module=org.jboss.logmanager.ext) 26 | 27 | # Add a socket-handler using the logstash formatter. Replace the hostname and port to the values needed for your logstash install 28 | /subsystem=logging/custom-handler=logstash-handler:add(class=org.jboss.logmanager.ext.handlers.SocketHandler,module=org.jboss.logmanager.ext,named-formatter=logstash,properties={hostname=$HOST, port=5000}) 29 | 30 | # Add the new handler to the root-logger 31 | /subsystem=logging/root-logger=ROOT:add-handler(name=logstash-handler) 32 | 33 | # Reload the server which will boot the server into normal mode as well as write messages to logstash 34 | run-batch 35 | :reload 36 | 37 | EOF 38 | 39 | echo "=> Shutting down WildFly" 40 | $JBOSS_CLI -c ":shutdown" 41 | 42 | echo "=> Restarting WildFly" 43 | $JBOSS_HOME/bin/standalone.sh -b 0.0.0.0 44 | -------------------------------------------------------------------------------- /wildfly-management/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jboss/wildfly:latest 2 | 3 | 4 | USER jboss 5 | 6 | EXPOSE 8080 9990 7 | 8 | USER jboss 9 | RUN /opt/jboss/wildfly/bin/add-user.sh -u admin -p docker#admin --silent 10 | CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] 11 | 12 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jboss/wildfly:latest 2 | #FROM arungupta/wildfly-centos 3 | 4 | ADD customization /opt/jboss/wildfly/customization/ 5 | 6 | CMD ["/opt/jboss/wildfly/customization/execute.sh"] 7 | 8 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/README.asciidoc: -------------------------------------------------------------------------------- 1 | = Docker Containers using Bridge and Overlay Network 2 | 3 | This is a Java EE application deployed on WildFly and uses MySQL database. 4 | 5 | == Docker Containers using Bridge Network 6 | 7 | ```console 8 | docker-compose --x-networking up -d 9 | ``` 10 | 11 | == Docker Containers using Overlay Network 12 | 13 | More details: http://blog.arungupta.me/docker-container-linking-across-multiple-hosts-techtip69/ 14 | 15 | == Tips 16 | 17 | . Build the image locally: `docker build -t arungupta/wildfly-mysql-javaee7 .` 18 | . Log into the container: `sudo docker exec -it mysqldb bash` 19 | . Find IP address of the container: `sudo docker inspect -f '{{ .NetworkSettings.IPAddress }}' mysqldb` 20 | 21 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/customization/employees.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arun-gupta/docker-images/0659ccc1792c958960537065109ebbd92db92f2c/wildfly-mysql-javaee7/customization/employees.war -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/customization/execute.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Usage: execute.sh [WildFly mode] [configuration file] 4 | # 5 | # The default mode is 'standalone' and default configuration is based on the 6 | # mode. It can be 'standalone.xml' or 'domain.xml'. 7 | 8 | JBOSS_HOME=/opt/jboss/wildfly 9 | JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh 10 | JBOSS_MODE=${1:-"standalone"} 11 | JBOSS_CONFIG=${2:-"$JBOSS_MODE.xml"} 12 | 13 | function wait_for_server() { 14 | until `$JBOSS_CLI -c ":read-attribute(name=server-state)" 2> /dev/null | grep -q running`; do 15 | sleep 1 16 | done 17 | } 18 | 19 | echo "=> Starting WildFly server" 20 | $JBOSS_HOME/bin/$JBOSS_MODE.sh -b 0.0.0.0 -c $JBOSS_CONFIG & 21 | 22 | echo "=> Waiting for the server to boot" 23 | wait_for_server 24 | 25 | echo "=> Executing the commands" 26 | echo "=> MYSQL_HOST (explicit): " $MYSQL_HOST 27 | echo "=> MYSQL_PORT (explicit): " $MYSQL_PORT 28 | echo "=> MYSQL (docker host): " $DB_PORT_3306_TCP_ADDR 29 | echo "=> MYSQL (docker port): " $DB_PORT_3306_TCP_PORT 30 | echo "=> MYSQL (k8s host): " $MYSQL_SERVICE_SERVICE_HOST 31 | echo "=> MYSQL (k8s port): " $MYSQL_SERVICE_SERVICE_PORT 32 | echo "=> MYSQL_URI (docker with networking): " $MYSQL_URI 33 | 34 | $JBOSS_CLI -c << EOF 35 | batch 36 | 37 | #set CONNECTION_URL=jdbc:mysql://$MYSQL_SERVICE_SERVICE_HOST:$MYSQL_SERVICE_SERVICE_PORT/sample 38 | set CONNECTION_URL=jdbc:mysql://$MYSQL_URI/sample 39 | echo "Connection URL: " $CONNECTION_URL 40 | 41 | # Add MySQL module 42 | module add --name=com.mysql --resources=/opt/jboss/wildfly/customization/mysql-connector-java-5.1.31-bin.jar --dependencies=javax.api,javax.transaction.api 43 | 44 | # Add MySQL driver 45 | /subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource) 46 | 47 | # Add the datasource 48 | #data-source add --name=mysqlDS --driver-name=mysql --jndi-name=java:jboss/datasources/ExampleMySQLDS --connection-url=jdbc:mysql://$MYSQL_HOST:$MYSQL_PORT/sample?useUnicode=true&characterEncoding=UTF-8 --user-name=mysql --password=mysql --use-ccm=false --max-pool-size=25 --blocking-timeout-wait-millis=5000 --enabled=true 49 | #data-source add --name=mysqlDS --driver-name=mysql --jndi-name=java:jboss/datasources/ExampleMySQLDS --connection-url=jdbc:mysql://$MYSQL_SERVICE_HOST:$MYSQL_SERVICE_PORT/sample?useUnicode=true&characterEncoding=UTF-8 --user-name=mysql --password=mysql --use-ccm=false --max-pool-size=25 --blocking-timeout-wait-millis=5000 --enabled=true 50 | #data-source add --name=mysqlDS --driver-name=mysql --jndi-name=java:jboss/datasources/ExampleMySQLDS --connection-url=jdbc:mysql://$DB_PORT_3306_TCP_ADDR:$DB_PORT_3306_TCP_PORT/sample?useUnicode=true&characterEncoding=UTF-8 --user-name=mysql --password=mysql --use-ccm=false --max-pool-size=25 --blocking-timeout-wait-millis=5000 --enabled=true 51 | #data-source add --name=mysqlDS --driver-name=mysql --jndi-name=java:jboss/datasources/ExampleMySQLDS --connection-url=jdbc:mysql://$MYSQL_SERVICE_SERVICE_HOST:$MYSQL_SERVICE_SERVICE_PORT/sample --user-name=mysql --password=mysql --use-ccm=false --max-pool-size=25 --blocking-timeout-wait-millis=5000 --enabled=true 52 | data-source add --name=mysqlDS --driver-name=mysql --jndi-name=java:jboss/datasources/ExampleMySQLDS --connection-url=jdbc:mysql://$MYSQL_URI/sample?useUnicode=true&characterEncoding=UTF-8 --user-name=mysql --password=mysql --use-ccm=false --max-pool-size=25 --blocking-timeout-wait-millis=5000 --enabled=true 53 | 54 | # Execute the batch 55 | run-batch 56 | EOF 57 | 58 | # Deploy the WAR 59 | cp /opt/jboss/wildfly/customization/employees.war $JBOSS_HOME/$JBOSS_MODE/deployments/employees.war 60 | 61 | echo "=> Shutting down WildFly" 62 | if [ "$JBOSS_MODE" = "standalone" ]; then 63 | $JBOSS_CLI -c ":shutdown" 64 | else 65 | $JBOSS_CLI -c "/host=*:shutdown" 66 | fi 67 | 68 | echo "=> Restarting WildFly" 69 | $JBOSS_HOME/bin/$JBOSS_MODE.sh -b 0.0.0.0 -c $JBOSS_CONFIG 70 | 71 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/customization/mysql-connector-java-5.1.31-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arun-gupta/docker-images/0659ccc1792c958960537065109ebbd92db92f2c/wildfly-mysql-javaee7/customization/mysql-connector-java-5.1.31-bin.jar -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/docker-compose.yml: -------------------------------------------------------------------------------- 1 | mysqldb: 2 | container_name: "db" 3 | image: mysql:latest 4 | environment: 5 | MYSQL_DATABASE: sample 6 | MYSQL_USER: mysql 7 | MYSQL_PASSWORD: mysql 8 | MYSQL_ROOT_PASSWORD: supersecret 9 | mywildfly: 10 | image: arungupta/wildfly-mysql-javaee7 11 | environment: 12 | - MYSQL_URI=db:3306 13 | ports: 14 | - 8080:8080 15 | 16 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/employees/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | org.javaee7.jpa 5 | employees 6 | 1.0-SNAPSHOT 7 | war 8 | 9 | 10 | 11 | javax 12 | javaee-api 13 | 7.0 14 | provided 15 | 16 | 17 | 18 | 19 | employees 20 | 21 | 22 | org.apache.maven.plugins 23 | maven-war-plugin 24 | 2.5 25 | 26 | false 27 | 28 | 29 | 30 | org.wildfly.plugins 31 | wildfly-maven-plugin 32 | 1.0.2.Final 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/employees/src/main/java/org/javaee7/samples/employees/Employee.java: -------------------------------------------------------------------------------- 1 | package org.javaee7.samples.employees; 2 | 3 | import java.io.Serializable; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.GenerationType; 8 | import javax.persistence.Id; 9 | import javax.persistence.NamedQueries; 10 | import javax.persistence.NamedQuery; 11 | import javax.persistence.Table; 12 | import javax.xml.bind.annotation.XmlRootElement; 13 | 14 | /** 15 | * @author Arun Gupta 16 | */ 17 | @Entity 18 | @Table(name = "EMPLOYEE_SCHEMA") 19 | @NamedQueries({ 20 | @NamedQuery(name = "Employee.findAll", query = "SELECT e FROM Employee e"), 21 | @NamedQuery(name = "Employee.findById", query = "SELECT e FROM Employee e where e.id = :id") 22 | }) 23 | @XmlRootElement 24 | public class Employee implements Serializable { 25 | private static final long serialVersionUID = 1L; 26 | @Id 27 | @GeneratedValue(strategy = GenerationType.AUTO) 28 | private int id; 29 | 30 | @Column(length=40) 31 | private String name; 32 | 33 | public Employee() { } 34 | 35 | public Employee(String name) { 36 | this.name = name; 37 | } 38 | 39 | public int getId() { 40 | return id; 41 | } 42 | 43 | public void setId(int id) { 44 | this.id = id; 45 | } 46 | 47 | public String getName() { 48 | return name; 49 | } 50 | 51 | public void setName(String name) { 52 | this.name = name; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/employees/src/main/java/org/javaee7/samples/employees/EmployeeEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.javaee7.samples.employees; 2 | 3 | import javax.enterprise.context.ApplicationScoped; 4 | import javax.persistence.EntityManager; 5 | import javax.persistence.PersistenceContext; 6 | import javax.ws.rs.GET; 7 | import javax.ws.rs.Path; 8 | import javax.ws.rs.PathParam; 9 | import javax.ws.rs.Produces; 10 | 11 | /** 12 | * @author Arun Gupta 13 | */ 14 | @Path("employees") 15 | @ApplicationScoped 16 | public class EmployeeEndpoint { 17 | 18 | @PersistenceContext 19 | EntityManager em; 20 | 21 | @GET 22 | @Produces({"application/xml", "application/json"}) 23 | public Employee[] get() { 24 | return em.createNamedQuery("Employee.findAll", Employee.class).getResultList().toArray(new Employee[0]); 25 | } 26 | 27 | @GET 28 | @Path("{id}") 29 | @Produces({"application/xml", "application/json"}) 30 | public Employee get(@PathParam("id") int id) { 31 | return em 32 | .createNamedQuery("Employee.findById", Employee.class) 33 | .setParameter("id", id) 34 | .getSingleResult(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/employees/src/main/java/org/javaee7/samples/employees/MyApplication.java: -------------------------------------------------------------------------------- 1 | package org.javaee7.samples.employees; 2 | 3 | import javax.ws.rs.ApplicationPath; 4 | import javax.ws.rs.core.Application; 5 | 6 | /** 7 | * @author arungupta 8 | */ 9 | @ApplicationPath("resources") 10 | public class MyApplication extends Application { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/employees/src/main/resources/META-INF/load.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (1, 'Penny') 2 | INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (2, 'Sheldon') 3 | INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (3, 'Amy') 4 | INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (4, 'Leonard') 5 | INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (5, 'Bernadette') 6 | INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (6, 'Raj') 7 | INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (7, 'Howard') 8 | INSERT INTO EMPLOYEE_SCHEMA(ID, NAME) VALUES (8, 'Priya') -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/employees/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | java:jboss/datasources/ExampleMySQLDS 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /wildfly-mysql-javaee7/employees/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Employees 5 | 6 | 7 | 8 | 9 |
    10 |
  • GET all employees.
  • 11 |
  • GET 1 employee.
  • 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /wildfly-override/docker-compose.override.yml: -------------------------------------------------------------------------------- 1 | mywildfly: 2 | ports: 3 | - 9080:8080 4 | -------------------------------------------------------------------------------- /wildfly-override/docker-compose.yml: -------------------------------------------------------------------------------- 1 | mywildfly: 2 | image: jboss/wildfly 3 | ports: 4 | - 8080:8080 5 | -------------------------------------------------------------------------------- /wildfly-ubuntu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | MAINTAINER Arun Gupta 3 | 4 | # Execute system update 5 | RUN apt-get update 6 | 7 | # Install packages necessary to run EAP 8 | RUN apt-get -y install xmlstarlet bsdtar unzip curl 9 | 10 | # Create a user and group used to launch processes 11 | # The user ID 1000 is the default for the first "regular" user on Fedora/RHEL, 12 | # so there is a high chance that this ID will be equal to the current user 13 | # making it easier to use volumes (no permission issues) 14 | RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss 15 | 16 | # Set the working directory to jboss' user home directory 17 | WORKDIR /opt/jboss 18 | 19 | # User root user to install software 20 | USER root 21 | 22 | # Install necessary packages 23 | RUN apt-get -y install openjdk-7-jdk 24 | 25 | # Switch back to jboss user 26 | USER jboss 27 | 28 | # Set the JAVA_HOME variable to make it clear where Java is located 29 | ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64 30 | 31 | # Set the WILDFLY_VERSION env variable 32 | ENV WILDFLY_VERSION 8.2.0.Final 33 | 34 | # Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content 35 | # Make sure the distribution is available from a well-known place 36 | RUN cd $HOME && curl -O http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip && unzip wildfly-$WILDFLY_VERSION.zip && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly && rm wildfly-$WILDFLY_VERSION.zip 37 | 38 | # Set the JBOSS_HOME env variable 39 | ENV JBOSS_HOME /opt/jboss/wildfly 40 | 41 | # Expose the ports we're interested in 42 | EXPOSE 8080 9990 43 | 44 | # Set the default command to run on boot 45 | # This will boot WildFly in the standalone mode and bind to all interface 46 | CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-c", "standalone-full.xml", "-b", "0.0.0.0"] 47 | -------------------------------------------------------------------------------- /wildfly/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use latest jboss/base-jdk:8 image as the base 2 | FROM jboss/base-jdk:8 3 | 4 | # Set the WILDFLY_VERSION env variable 5 | ENV WILDFLY_VERSION 9.0.0.Final 6 | 7 | # Add the WildFly distribution to /opt, and make wildfly the owner of the extracted tar content 8 | # Make sure the distribution is available from a well-known place 9 | RUN cd $HOME && curl -O http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip && unzip wildfly-$WILDFLY_VERSION.zip && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly && rm wildfly-$WILDFLY_VERSION.zip 10 | 11 | # Set the JBOSS_HOME env variable 12 | ENV JBOSS_HOME /opt/jboss/wildfly 13 | 14 | # Expose the ports we're interested in 15 | EXPOSE 8080 9990 16 | 17 | # Set the default command to run on boot 18 | # This will boot WildFly in the standalone mode and bind to all interface 19 | CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-c", "standalone-full.xml", "-b", "0.0.0.0"] 20 | --------------------------------------------------------------------------------