Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Docker stuff I use

 In this post I will describe a few of the Docker stuff I currently use. May not work for everyone but it may help you get started.

First, if you have a dockerfile you need to build it. I often use intermediate images during the build process (for installing compiling tools). I also call these images stage=intermediate. A simple build script looks like this:

docker build --tag IMAGENAME .

docker rmi -f $(docker images -q --filter label=stage=intermediate)

After successfully building the image, you need to start it. Depending on the image you may need to map ports or data volumes. However, one thing I find useful is to also run docker ps after starting the Docker image. This helps me to check if it really started and didn't exit immediately for some reason. I also start the image with a -RUNNING added to the name. This helps me to better identify the existing images. A simple startup script looks like this:

docker run --name "IMAGENAME-running" -d -p 80:80 IMAGENAME

docker ps

Finally, at some point you may wish to stop the running image. When I stop it, I also remove the -RUNNING image, like this:

docker stop IMAGENAME-running

docker rm IMAGENAME-running

In the unfortunate case of an unscheduled system reboot, you should first run the stop script. This will take care of removing the -RUNNING image and will enable you to start it again using the start script above.




This post first appeared on My, please read the originial post: here

Share the post

Docker stuff I use

×

Subscribe to My

Get updates delivered right to your inbox!

Thank you for your subscription

×