Mirantis
Published in

Mirantis

How to Run a Containerized App with Docker

One of the biggest challenges for implementing cloud native technologies is learning the fundamentals — especially when you need to fit your learning into a busy schedule.

In this series, we’ll break down core cloud native concepts, challenges, and best practices into short, manageable exercises and explainers, so you can learn five minutes at a time. These lessons assume a basic familiarity with the Linux command line and a Unix-like operating system — beyond that, you don’t need any special preparation to get started.

In our last lesson, we defined some core concepts in container networking and learned how to publish container ports, opening a container’s services to traffic from the outside world. This time, we’re going to bring together most of what we’ve learned so far to run a containerized web app with persistent volumes and published ports: in this case, a knowledge-sharing wiki platform.

Table of Contents

  1. What is a Container?
  2. Creating, Observing, and Deleting Containers
  3. Build Image from Dockerfile
  4. Using an Image Registry
  5. Volumes and Persistent Storage
  6. Container Networking and Opening Container Ports
  7. Running a Containerized App ←You are here

Bringing the pieces together

Wikipedia is built on an open source platform called Mediawiki, and an official Docker image for the application is maintained on Docker Hub. That means it should be easy to get our own wiki running quickly — in less than five minutes, even!

The default architecture for this deployment is very straightforward: a single container for the application, which can either write data to a volume all on its own — the default configuration — or work in tandem with a second container running a production-grade database — the option you would want to use if you were taking this wiki to production, pushing it live for real-world use.

In this lesson, we’re going to start with a single-container configuration — but we won’t stop there. Next time, we’ll also explore how to link containers for a more production-ready configuration.

But we’re getting ahead of ourselves. For now, let’s focus on getting our wiki up and running!

Exercise: A Wiki as a Containerized App

Let’s start by creating a new volume that will store the persistent data for our wiki:

docker volume create wiki-data

Now we’re going to run a Docker container based on the official Mediawiki image. We’ll call our new container solo-wiki since it’s going to run in a single-container configuration. We’ll also publish a port so we can access the application on our host machine, and add our volume for persistent storage.

docker run --name solo-wiki -v wiki-data:/wiki-data -p 8000:80 -d mediawiki

Now when we visit localhost:8000 in our web browser, we should see a starting page for our wiki. But the app still needs to be set up. On the starting page, click “Complete the installation.”

To follow the rest of the tutorial, read the full post at the Mirantis blog.

--

--

--

Mirantis is the leading provider of open source, cloud native data center as-a-service, designed to help developers ship their most valuable code faster on any infrastructure. Headquartered in Silicon Valley, Mirantis powers innovation for Global 2k organizations

Recommended from Medium

Don’t Fucking Deploy on Friday

Automated Location Mapping — GSoC 2021 Week 7

News — WordPress 5.6 Release Candidate

Kijana Umetoka Wapi…Dev Encounter.

Reactive Programming: What & Why? — Part IV

How to Configure Safari to Use a Proxy Server on a Mac

Consensus is Overrated, Build Clarity Instead

Let’s Build an Own Operating System (PrimitiveOS)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eric Gregory

Eric Gregory

More from Medium

Docker reverse proxy using Traefik

Docker, nginx and reverse-proxying

Multi-Container Apps on User-Defined Networks

Podman Tutorial: Getting started with the container engine without daemon