Loading…
Warp is now open-source Learn more
Loading…
You can find instructions here for installing it for your device, depending on if you’re on Mac, Linux, or Windows.
https://docs.docker.com/get-docker/
To check if you already have Docker installed, you can run this command:
docker --versionThese steps are optional, but I personally think that downloading these two tools is the easiest way to learn Docker. Here is why:

brew install jesseduffield/lazydocker/lazydocker
brew install --cask warpThere are a few fundamental building blocks for understanding Docker.
Essentially, Dockerfiles are blueprints used to create Docker images, and Docker images are the blueprints used to create Docker containers. The reason why they do this is…
How the flow usually works is:
Let’s apply these concepts. This is where LazyDocker and Warp will come in handy.
lazydockerWhich will open up the LazyDocker TUI in that pane. Your setup should look something like this:

“Can you create a Dockerfile for me and explain what it does?”
The response you get may differ depending on what Warp’s AI (Agent Mode) feature outputs, but here is the Dockerfile it created for me:
# Use the official Ubuntu base image
FROM ubuntu:20.04
# Set the maintainer label
LABEL maintainer="your_email@example.com"
# Update the package repository and install some software packages
RUN apt-get update && apt-get install -y \
python3 \
python3-pip
# Set the working directory inside the container
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Make port 80 available to the world outside this container
EXPOSE 80
# Define the command to run the application
CMD ["python3", "app.py"]Here is the breakdown of the Dockerfile:
“Please build the Dockerfile you just created”
I like typing my intent into Warp using natural language because I don’t have to worry about adding all the right flags/directory names correctly when running the base command. Even though I’ll eventually need to learn the meaning behind each parameter, I don’t want to get bogged down by this during my beginner learning stage. The command it generated for me was:
docker build -t my-python-appOnce you create the image, you should see it show up in LazyDocker’s TUI:

“Can you create a container from the Docker image you just created?”
And you can see in the screenshot below that it generates the command for me:
docker run -d --name my-python-app-container my-python-app:v1
Another thing I like about using Warp’s Agent Mode is that it can easily help me debug and fix errors without much context switching. When I tried to run this command at first, I ran into an error because my Docker image was trying to run the command python3 app.py but app.py did not exist:

As you can see in the screenshot above, Warp generated this command:
# Create a simple placeholder app.py file
echo 'print("Hello, Docker!")' > app.py
# Rebuild the Docker image
docker build -t my-python-app:v1
# Run the container with the new image
docker run -d --name my-python-app-container my-python-app:v1Which creates a simple app.py file in my directory that prints “Hello Docker!”, and then (my favorite part) regenerates the Docker image and Docker container without me having to prompt it to rebuild everything. After running these commands, you’ll see that my LazyDocker TUI now shows a running container:


Now that we understand the basic flow of how to use Docker, let’s dive into why the concept of Docker containers are important to developer productivity. To do this, we’re going to set up multiple services running in different containers, demonstrating how Docker can easily help you set up a simple microservices architecture with minimal hassle.
In fact, I’m going to let Warp walk you through this demo. I’m going to type the following prompt into Warp’s Agent Mode:
Can you create 3 different containers each running different types of services to demonstrate how Docker can easily create a microservices architecture?

First, it prompts you to run:
docker network create microserves_demoWhich creates a new user-defined network in Docker named “microservices\_demo” and allows multiple Docker containers to communicate with each other. Then, it asks to create three different Docker containers running different types of services:

Here’s the specific command:
docker run -d --name web_service --network microservices_demo nginx && \
docker run -d --name db_service --network microservices_demo -e MYSQL_ROOT_PASSWORD=root mysql && \
docker run -d --name cache_service --network microservices_demo redisIn this case, I was able to create these containers without first creating a Dockerfile or Docker image because these commands use existing official Docker images from the Docker Hub, which is a cloud-based repository that holds Docker images. These images are pre-built and maintained by their respective communities.
Once I run this command, I can see that my three new services (cache\_service, db\_service, and web\_service) are all running in their own Docker containers in LazyDocker.

Here are two important takeaways from this demonstration.
For example, suppose that the web\_service container creates a file at /app/logs/error.log. This file is only visible within that container and does not affect the db\_service container.
Another example is that the web\_service container can run processes like nginx which is independent of the MySQL processes running in the db\_service container. I can even run a command like ps aux inside the web\_service container and see processes only related to that container (and not db\_service).
For example, let’s say web\_service needs to store user profile data in the database managed by db\_service. Or maybe web\_service wants to use cache\_service to cache user session data or frequently accessed query results to avoid hitting the database repeatedly. Docker would automatically set up a DNS service within the network that maps the container names to their IP address.
This only scratches the surface of what Docker can do, but with Warp and LazyDocker, there’s a lot of exploration you can do with the tool on your own to learn more. Good luck!
Learn how to launch and connect to a containerized SSH server in Docker using password-based authentication and SSH keys.
Learn how to remove a Docker image locally, on a Docker registry, and on Artifactory.
Learn how to override and customize the entrypoint of a Docker container using the docker run command.
Learn how to define and set build-time variables for Docker images using the ARG instruction and the --build-arg flag.
Learn how to start a new Docker container from an image in both the foreground and the background using the docker-run command.
How to gracefully shutdown running containers and forcefully kill unresponsive containers with signals in Docker using the docker-stop and docker-kill commands.
Learn how to set, change and match a docker container hostname.
Learn how define and pass environment variables to Docker containers using an .env file in Docker Compose.
Learn how to write and use .env files in Docker to populate the environment of containers on startup.
Learn how to restart Docker containers automatically with restart policies and manually using the docker restart, docker start, docker stop and docker kill commands.
Start an interactive shell in Docker container
Learn how to launch a MySQL container in Docker Compose.
docker --versionbrew install jesseduffield/lazydocker/lazydockerbrew install --cask warp# Use the official Ubuntu base image
FROM ubuntu:20.04
# Set the maintainer label
LABEL maintainer="your_email@example.com"
# Update the package repository and install some software packages
RUN apt-get update && apt-get install -y \
python3 \
python3-pip
# Set the working directory inside the container
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Make port 80 available to the world outside this container
EXPOSE 80
# Define the command to run the application
CMD ["python3", "app.py"]docker build -t my-python-appdocker run -d --name my-python-app-container my-python-app:v1# Create a simple placeholder app.py file
echo 'print("Hello, Docker!")' > app.py
# Rebuild the Docker image
docker build -t my-python-app:v1
# Run the container with the new image
docker run -d --name my-python-app-container my-python-app:v1docker network create microserves_demodocker run -d --name web_service --network microservices_demo nginx && \
docker run -d --name db_service --network microservices_demo -e MYSQL_ROOT_PASSWORD=root mysql && \
docker run -d --name cache_service --network microservices_demo redis