Run docker-compose up
from within mojito/docker/
or docker-compose -f docker/docker-compose.yml up
from the
project directory. It will start Mysql and build/start the Webapp.
In detached mode docker compose up -d
. And to remove everything including volumes: docker compose rm -s -v
to remove volumes.
To re-use a pre-built image, uncomment the image
configuration in docker-compose.yml
.
For older version, may need to set some env variable COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose up
Create the data directory for mysql: mkdir mojito/docker/.data/db
services:
db:
image: mysql:5.7
volumes:
- "./.data/db:/var/lib/mysql"
or named volumes
volumes:
- mojito_mysql
services:
db:
image: mysql:5.7
volumes:
- "mojito_mysql:/var/lib/mysql"
208.1 # A fatal error has been detected by the Java Runtime Environment:
208.1 #
208.1 # SIGSEGV (0xb) at pc=0x00007fffe7f0f4d0, pid=7, tid=22
This is a result of not allocating enough disk space and or memory to the docker environment. Make sure to increase the memory limit and disk usage limit in docker desktop.
Incompatibility Mac/Linux for (.dockerignore solves this)node/
node_modules/
, remove the directories before calling docker commands. Some
Dockerfile
remove the directories explicitly.
Build: docker build -t aurambaj/mojito-cli -f docker/Dockerfile-cli-bk8 .
and push: docker push aurambaj/mojito-cli:latest
Example to run a command:
docker run --rm --name mojito-cli -it -e MOJITO_HOST="mojito.org" -e MOJITO_PORT="443" -e MOJITO_SCHEME="https" aurambaj/mojito-cli repo-view -n demo1
Build: docker build -t aurambaj/mojito-webapp -f docker/Dockerfile-bk8 .
and push: docker push aurambaj/mojito-webapp:latest
Start the webapp: docker run --rm --name mojito-webapp -it aurambaj/mojito-webapp
and
get a shell to try some command docker exec -it mojito-webapp bash
Depending on the version of docker
DOCKER_BUILDKIT=1 docker build -t aurambaj/mojito-webapp-bk8 -f docker/Dockerfile-bk8 .
To build manually docker build -t aurambaj/mojito-webapp-ms8 -f docker/Dockerfile-ms8 .
First build the Webapp with mvn clean install -DskipTests
In the webapp/target
directory run docker build -t aurambaj/mojito-webapp-old -f ../src/main/docker/Dockerfile .
To test run it: docker run -p 8080:8080 aurambaj/mojito-webapp-old:latest
Create a docker image only with the build binaries, and use docker-compose to build locally by mounting the source code
and .m2
repository
docker-compose -f docker/docker-compose-build.yml run compile
This is not needed with Docker Desktop for Mac but was needed before so for the reccord
Depending on how you instlled docker on Mac, localhost
may not work. To get the IP to reach the service: docker-machine ip default
.
export l10n_resttemplate_host="192.168.99.111"
and then whatever CLI command you have to run, eg.
mojito demo-create -n dockertest
services:
db:
image: mysql:5.7
user: "1000:50" # needed on Mac
volumes:
- "./.data/db:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: ChangeMe
MYSQL_DATABASE: mojito
MYSQL_USER: mojito
MYSQL_PASSWORD: ChangeMe
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_bin
- --innodb_use_native_aio=0 # needed on Mac
FROM adoptopenjdk:8-jre
--> FROM adoptopenjdk/openjdk8:alpine-jre
and change to echo -e
for script generation
and make sure to use /bin/echo
for consistent behavior between alpine and ubuntu.