What is a container?
A container is an isolated environment for your code. This means that a container has no knowledge of your operating system, or your files. It runs on the environment provided to you by Docker Desktop. Containers have everything that your code needs in order to run, down to a base operating system. You can use Docker Desktop to manage and explore your containers.
In this walkthrough, you'll view and explore an actual container in Docker Desktop.
Before you start, get Docker Desktop.
The first thing you need is a running container. Use the following instructions to run a container.
- Open Docker Desktop and select the search.
docker/welcome-to-dockerin the search and then select Run.
- Expand the Optional settings.
- In Container name, specify
- In Host port, specify
- Select Run.
You just ran a container! You can view it in the Containers tab of Docker Desktop. This container runs a simple web server that displays a simple website. When working with more complex projects, you'll run different parts in different containers. For example, a different container for the frontend, backend, and database. In this walkthrough, you only have a simple frontend container.
The frontend is accessible on port 8088 of your local host. Select the link in the Port(s) column of your container, or visit http://localhost:8088open_in_new in your browser to view it.
Docker Desktop lets you easily view and interact with different aspects of your container. Try it out yourself. Select your container and then select Files to explore your container's isolated file system.
welcome-to-docker container continues to run until you stop it. To stop
the container in Docker Desktop, go to the Containers tab and select the
Stop icon in the Actions column of your container.
In this walkthrough, you ran a pre-made image and explored a container. In addition to running pre-made images, you can build and run your own application as container.
- Read more about containers in Use containers to Build, Share and Run your applicationsopen_in_new
- Deep dive in Liz Rice's Containers from Scratchopen_in_new video presentation
Continue to the next walkthrough to learn what you need to create your own image and run it as container.