Operations 9 min read

Speed Up Docker Pulls and Master Basic Container Commands

This guide shows how to configure Docker registry mirrors for faster image pulls, pull and run an Nginx container, and use essential Docker commands for inspecting, managing, and networking containers, complete with practical examples and code snippets.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Speed Up Docker Pulls and Master Basic Container Commands

This article explains how to accelerate Docker image downloads by configuring registry mirror sources. Create or edit /etc/docker/daemon.json and add a "registry-mirrors" array with one or more mirror URLs, such as https://dockerproxy.com or https://docker.m.daocloud.io. Save the file, then reload the daemon and restart Docker:

sudo systemctl daemon-reload
sudo systemctl restart docker

Verify the configuration with docker info to ensure the mirrors appear under the Registry Mirrors section.

Next, pull an image (e.g., docker pull nginx) and run it in detached mode, mapping host port 8090 to container port 80 and naming the container nginx-container:

docker run -d -p 8090:80 --name nginx-container nginx:latest

Example output shows the container ID, status, and port mapping. Key run options are explained: -d: run container in background. -p host:container: map ports. --name: assign a readable name. nginx:latest: image reference. -it: interactive terminal (not used here). -v: mount volumes. --volumes-from: inherit volumes from another container.

View container logs with docker logs <container_id> and access the service via a browser at http://localhost:8090, confirming Nginx runs correctly.

Use docker inspect to retrieve detailed JSON information about containers, images, networks, or volumes: docker inspect nginx-container Additional useful commands covered include: docker start / docker restart – start or restart containers. docker ps -a – list all containers. docker stop – stop a running container. docker exec -it <container> /bin/bash – open an interactive shell without stopping the container. docker top <container> – view processes inside a container. docker rm – remove containers (stop first if needed). docker images – list local images. docker start $(docker ps -a -q) – start all stopped containers.

To modify files inside a container, either use docker exec with an editor (e.g., vi) or copy files out, edit on the host, and copy back with docker cp.

Docker’s default bridge network assigns IPs automatically, but you can create a custom bridge network (e.g., dockercompose) with a specific subnet and gateway, then run containers on that network with a fixed IP:

docker network create --driver bridge --subnet=172.19.0.0/16 --gateway=172.19.0.1 dockercompose
docker run -it --name nginx-second --network=dockercompose --ip 172.19.0.6 nginx

Inspect the container to confirm the assigned IP address. Finally, retrieve volume information with docker inspect -f {{.Volumes}} <container_name>.

DockerNginxNetworkingContainer Managementregistry-mirrors
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.