2019-02-08 06:30:52 -05:00
# Docker Image Example
2019-02-04 18:49:59 -05:00
2020-05-20 21:12:41 -04:00
This is an example on how you could create your own Docker Image For Apache ActiveMQ Artemis based on CentOS or Debian.
2019-02-04 18:49:59 -05:00
# Preparing
Use the script ./prepare-docker.sh as it will copy the docker files under the binary distribution.
```
2019-02-08 06:30:52 -05:00
$ ./prepare-docker.sh $ARTEMIS_HOME
2019-02-04 18:49:59 -05:00
```
# Building
2019-02-08 06:30:52 -05:00
Go to `$ARTEMIS_HOME` where you prepared the binary with Docker files.
2019-02-04 18:49:59 -05:00
2020-05-20 21:12:41 -04:00
## For Debian:
2019-02-04 18:49:59 -05:00
2019-02-08 06:30:52 -05:00
From within the `$ARTEMIS_HOME` folder:
2019-02-04 18:49:59 -05:00
```
2020-05-20 21:12:41 -04:00
$ docker build -f ./docker/Dockerfile-debian -t artemis-debian .
2019-02-04 18:49:59 -05:00
```
## For CentOS
2019-02-08 06:30:52 -05:00
From within the `$ARTEMIS_HOME` folder:
2019-02-04 18:49:59 -05:00
```
$ docker build -f ./docker/Dockerfile-centos -t artemis-centos .
```
2019-02-08 06:30:52 -05:00
**Note:**
2020-05-20 21:12:41 -04:00
`-t artemis-debian` ,`-t artemis-centos` are just tag names for the purpose of this guide
2019-02-08 06:30:52 -05:00
2019-02-04 18:49:59 -05:00
# Variables:
- ARTEMIS_USER
- ARTEMIS_PASSWORD
- ANONYMOUS_LOGIN
Default here is FALSE. If you set this to true, it will change security settings passed on the broker instance creation.
- CREATE_ARGUMENTS
2020-02-21 04:33:01 -05:00
Default here is `--user ${ARTEMIS_USER} --password ${ARTEMIS_PASSWORD} --silent --http-host 0.0.0.0 --relax-jolokia`
2019-02-04 18:49:59 -05:00
2019-02-08 06:30:52 -05:00
This will be passed straight to `./artemis create` during the execution.
2019-02-04 18:49:59 -05:00
# Mapping point
2019-02-08 06:30:52 -05:00
- `/var/lib/artemis-instance`
2019-02-04 18:49:59 -05:00
It's possible to map a folder as the instance broker.
This will hold the configuration and the data of the running broker. This is useful for when you want the data persisted outside of a container.
# Lifecycle of the execution
2019-02-08 06:30:52 -05:00
A broker instance will be created during the execution of the instance. If you pass a mapped folder for `/var/lib/artemis-instance` an image will be created or reused depending on the contents of the folder.
2019-02-04 18:49:59 -05:00
## Running a CentOS image
The image just created in the previous step allows both stateless or stateful runs.
The stateless run is achieved by:
```
$ docker run --rm -it -p 61616:61616 -p 8161:8161 artemis-centos
```
The image will also support mapped folders and mapped ports. To run the image with the instance persisted on the host:
```
docker run -it -p 61616:61616 -p 8161:8161 -v < broker folder on host > :/var/lib/artemis-instance artemis-centos
```
where `<broker folder on host>` is a folder where the broker instance is supposed to
be saved and reused on each run.