Testing Dockerfiles

While you are working with a Dockerfile, it's common that you want to rebuild the docker image, rerun the container with the new docker image and test quickly. Each time after you make a change in the Dockerfile, you will need to type the same commands to rebuild, rerun and test repeatedly.

By using TaskTips you can automate this process. Whenever you make a change, you can simply search and run this task, which will handle all the things automatically for you. Please see the example as below.

Example: Build and run custom milter docker

Task Type:

Terminal

Task Name:

Build and run custom milter docker

Task Instructions:

cd $HOME/work/my-containers/custom-milter
docker build -t tasktips/custom_milter:latest .
docker stop my_milter
docker rm my_milter
docker run -d --name my_milter \
    -p 25:25 -p 587:587 \
    custom_milter:latest
docker exec -it my_milter bash

Search Key: Empty

Safe Mode: Enabled

After you make changes in your Dockerfile, you can run this task which will do the following automatically:

  1. Rebuild the docker image
  2. Stop the running docker container
  3. Remove the old docker container
  4. Rerun a new docker container with new docker image
  5. Open bash of the new docker container in console

You can then continue your test with the new container from the current terminal. As you can see, to use TaskTips, you can do your tests very quickly.

Summary

It's common that you input same commands into your terminal again and again. The magic is that once you copy these commands and create a new task in TaskTips, you can simply search and execute this task automatically.