Run Stateless Docker Containers

InstructorMark Shust

Share this video with your friends

Send Tweet

Docker containers should be designed to be stateless, meaning that they can survive system reboots and container terminations gracefully, and without the loss of data. Designing with stateless containers in mind will also help your app grow and make future horizontal scaling trivial.

In this lesson, we will review an app that saves uploaded files to the filesystem. Then we will learn how to setup a persistent volume for the uploaded files so they can survive Docker container halts, restarts, stops and respawns.

Harshesh
~ 7 years ago

A question: where does appdata: volume points to?

Mark Shustinstructor
~ 7 years ago

The appdata: reference is basically pointing to a new scratch volume. It will store whatever you place on the volume, but outside of any container.

Harshesh
~ 7 years ago

..just clarifying, since the scratch location is not declared, it will consider the current location where we executed docker-compose command?

Mark Shustinstructor
~ 7 years ago

No, this volume lives within docker as a docker volume. You can view all docker volumes with the docker volume ls command.

zarcode
~ 6 years ago

I get this output:

$docker-compose up Building app Step 1/7 : FROM mhart/alpine-node ERROR: Service 'app' failed to build: Get https://registry-1.docker.io/v2/mhart/alpine-node/manifests/latest: unauthorized: incorrect username or password

Can I get some help?

Mark Shustinstructor
~ 6 years ago

That's an odd one -- perhaps you can try again? Almost appears as though docekr.io or dockerhub experienced a server outage.

zarcode
~ 6 years ago

You are right, thank you for help.

JP Erasmus
~ 6 years ago

Schrödinger's cat - very clever and funny!