This is another in my series of very short entries about Docker. I've been working to not install maven on my development laptop. But I still want to use spring-boot:run to launch my applications. Here is the Docker command I am using. Notice the server.port is specified on the command line so that I can change it as needed.


docker run \
  -it \
  --rm \
  -p 8090:8090 \
  -e server.port=8090 \
  --link artifactory:artifactory \
  --link mysql:mysql \
  -v "$PWD/m2":/root/.m2 \
  -v "$PWD":/usr/src/mymaven \
  -w /usr/src/mymaven \
  maven:3.3-jdk-8 \
  mvn spring-boot:run

The MySQL container was started like this:



docker run \
  --name mysql \
  -p 3306:3306 \
  -v /data/mysql:/var/lib/mysql \
  -e MYSQL_ROOT_PASSWORD=password \
  -e MYSQL_DATABASE=docker \
  -e MYSQL_USER=docker \
  -e MYSQL_PASSWORD=password \
  -d \
  mysql/mysql-server:5.5