Operations 10 min read

Speed Up Docker Pulls and Master Container Management with Simple Commands

This guide shows how to configure Docker registry mirrors for faster image pulls, run and manage containers—including starting, inspecting, networking, and file editing—using concise command‑line examples and practical tips for Linux environments.

Raymond Ops
Raymond Ops
Raymond Ops
Speed Up Docker Pulls and Master Container Management with Simple Commands

2. Pull an Image

Example: pull the latest Nginx image.

<code>docker pull nginx</code>

3. First Run of the Image

Run the container in detached mode and map host port 8090 to container port 80:

<code>docker run -d -p 8090:80 --name nginx-container nginx:latest</code>

Sample output shows the container ID and confirms it is running.

4. Inspect Command

docker inspect

provides detailed information about containers, images, networks, volumes, etc.

<code>docker inspect nginx-container</code>

5. Start an Existing Container

<code>docker start &lt;container_id_or_name&gt;
# or restart
docker restart &lt;container_id_or_name&gt;</code>

6. List Containers

<code>docker ps          # running containers
docker ps -a       # all containers</code>

7. Stop a Container

<code>docker stop &lt;container_id_or_name&gt;</code>

8. Enter a Container

<code>docker exec -it &lt;container_id_or_name&gt; /bin/bash</code>

Exiting the shell does not stop the container.

9. View Container Processes

<code>docker top &lt;container_name&gt;</code>

10. Delete a Container

<code>docker stop &lt;container_id_or_name&gt;
docker rm &lt;container_id_or_name&gt;
# Remove all stopped containers
docker rm $(docker ps -aq)</code>

11. List Images

<code>docker images</code>

12. Start All Containers

<code>docker start $(docker ps -a -q)</code>

13. Modify Files Inside a Container

Method 1: Use

docker exec

with an editor (e.g.,

vi

).

<code>docker exec -it &lt;container_id_or_name&gt; bash
# then edit files inside the container</code>

Method 2: Copy files out, edit on the host, and copy back.

<code>docker cp &lt;container_id_or_name&gt;:/path/to/file /host/path
# edit the file on the host
docker cp /host/path/file &lt;container_id_or_name&gt;:/path/to/file</code>

14. Create a Container with a Specific IP

Docker’s default bridge network assigns IPs automatically. For fixed IPs, create a custom bridge network and run the container on it.

<code>docker network create --driver bridge --subnet 172.19.0.0/16 --gateway 172.19.0.1 mynet</code>

15. View Network Modes

<code>docker network ls</code>

16. Create a New Bridge Network

<code>docker network create --driver bridge --subnet 172.19.0.0/16 --gateway 172.19.0.1 dockercompose</code>

17. Inspect Network Details

<code>docker network inspect dockercompose</code>

18. Run a Container on the Custom Network with a Fixed IP

<code>docker run -it --name nginx-second --network=dockercompose --ip 172.19.0.6 nginx</code>

Verify the IP with:

<code>docker inspect &lt;container_id&gt; | grep "IPAddress"</code>

19. View Volume Information

<code>docker inspect -f {{.Volumes}} &lt;container_name&gt;</code>

These commands cover common Docker operations for image acceleration, container lifecycle management, networking, and file handling.

Nginx running in browser
Nginx running in browser
DockerDevOpsLinuxContainerRegistry Mirror
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

login 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.