Get Started with Docker: Install, Pull Ubuntu, and Run Hello World
Learn how to install Docker on CentOS, start the service, pull the official Ubuntu image, and launch an interactive container to display a simple 'hello world' message, with step‑by‑step commands and screenshots illustrating each stage of the process.
Goal
Install and start Docker, download an Ubuntu base image, launch a container, and output “hello world”.
Installation
Docker requires a Linux kernel 3.8 or newer. On a CentOS 7 system the Docker package is available in the extras repository, so it can be installed directly with yum: sudo yum install -y docker Docker also runs on CentOS 6 (via EPEL) and on Windows/macOS with a virtual machine and Boot2Docker.
Start the Service
Start Docker, stop or restart it, and verify the installation: sudo service docker start To stop or restart: sudo service docker start | stop Check the version to confirm the daemon is running: docker version The command should display version information for both the client and server.
Download the Image
Pull the official Ubuntu image from Docker Hub: docker pull ubuntu The ubuntu tag refers to the latest version unless a specific tag is supplied.
List the images stored locally:
docker imagesRun a Container
Start an interactive Ubuntu container and open a shell: docker run -i -t ubuntu /bin/bash Inside the container you can execute commands. To display “hello world”: echo 'hello world' The output should be:
hello worldSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
