Connect with us

Hi, what are you looking for?


How to Run Docker applications

There are multiple ways to run Docker applications and the two that I use are “docker create” and “docker compose up”. Both have their pros and cons which I will explain in this post.

What is Docker Create?

Docker create command can be used to quickly fire up a Docker container. I use it mainly for testing Docker containers that are simple and without many dependencies. Docker Hub or the application’s Github page for example should outline the required variables that need to be set. If an application needs say mySQL and nginx it would make more sense to use docker compose.

When a container needs to have variables changed the container needs to be stopped and removed. Once that is completed the container can be re-created and started using the following commands:

docker stop <container-name>
docker rm <container-name>
docker create <container-name> <add rest of the required variables used when first deployed>
docker start <container-name>

When a container is to be updated the following commands can be executed:

docker pull <image-name>
docker stop <container-name>
docker rm <container-name>
docker create <container-name> <add rest of the required variables used when first deployed>

What is Docker Compose?

Docker compose is used to deploy multiple containers at a time which includes containers that can have multiple dependencies. Depending on my needs I sometimes jump straight to setting up a container in my docker compose file and deploying it. All that needs to be done is setup a “docker-compose.yml” file and define the containers inside of that file. A few important items to note are the syntax and formatting in the file matter which means that if something is misaligned or not in the proper format the Docker commands will throw an error. An easy way to check this is to run “docker-compose config” and it will indicate an error or will echo the contents of the file.

Some sample docker-compose commands:

Update all defined docker-compose images:
docker-compose pull
Deploy and/or deploy updated containers:
docker-compose up -d
Validate docker compose config file:
docker-compose config
Redeploy a select container:
docker-compose up -d --force-recreate --no-deps --build <container-name>

Example of Docker Create vs Docker Compose

Docker Create

docker pull hunterlong/statping
docker create --name=statping -e PUID=1000 -e PGID=1000 -p 8080:8080 -v C:/Docker/Statping:/app --restart unless-stopped hunterlong/statping
docker start statping

Docker Compose

version: '3.3'
        container_name: statping
            - PUID=1000
            - PGID=1000
            - '8080:8080'
            - 'C:/Docker/Statping:/app'
          - default
        restart: always
        image: hunterlong/statping
Click to comment

Leave a Reply

Your email address will not be published.

You May Also Like


Setting up NGINX with a free Let’s Encrypt SSL certificate is a breeze using Docker and the container maintained by The default setup...


Plex updated it’s support of collections at the end of 2017 by letting the user choose to group movies in a collection ie. Star...


Configure the TP-Link AX50 router so that it can be shared between both Windows and Linux. The router has USB sharing built into the...


Cloudflare has plenty to offer even to free users. I looked into some methods of improving the TTL or time to first byte as...

Copyright © 2021 Carl Peterson. Theme by MVP Themes, powered by WordPress.