6.3 KiB
description | keywords | title | redirect_from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Docker Hub Quickstart | Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, documentation, accounts, organizations, repositories, groups, teams | Docker Hub Quickstart |
|
Docker Hub is a service provided by Docker for finding and sharing container images with your team. It provides the following major features:
- Repositories: Push and pull container images.
- Teams & Organizations: Manage access to private repositories of container images.
- Official Images: Pull and use high-quality container images provided by Docker.
- Publisher Images: Pull and use high- quality container images provided by external vendors.
- Builds: Automatically build container images from GitHub and Bitbucket and push them to Docker Hub.
- Webhooks: Trigger actions after a successful push to a repository to integrate Docker Hub with other services.
Step 1: Sign up for Docker Hub
Start by creating an account.
Step 2: Create your first repository
To create a repo:
-
Sign in to Docker Hub.
-
Click on Create a Repository on the Docker Hub welcome page:
-
Name it <your-username>/my-first-repo as shown below. Select Private:
You've created your first repo. You should see:
Step 3: Download and install Docker Desktop
We'll need to download Docker Desktop to build and push a container image to Docker Hub.
-
Download and install Docker Desktop. If on Linux, download Docker Engine - Community.
-
Open the terminal and sign in to Docker Hub on your computer by running
docker login
.
Step 4: Build and push a container image to Docker Hub from your computer
- Start by creating a Dockerfile to specify your application as shown below:
cat > Dockerfile <<EOF
FROM busybox
CMD echo "Hello world! This is my first Docker image."
EOF
-
Run
docker build -t <your_username>/my-first-repo .
to build your Docker image. -
Run
docker run <your_username>/my-first-repo
to test your Docker image locally. -
Run
docker push <your_username>/my-first-repo
to push your Docker image to Docker Hub.You should see output similar to:
And in Docker Hub, your repository should have a new
latest
tag available under Tags:
Congratulations! You've successfully:
- Signed up for Docker Hub
- Created your first repository
- Built a Docker container image on your computer
- Pushed it to Docker Hub
Next steps
- Create an organization to use Docker Hub with your team.
- Automatically build container images from code through builds.
- Explore official & publisher images.
- Upgrade your plan to push additional private Docker images to Docker Hub.