Installing Docker-ce

Docker has finally taken off — most of the pitfalls have been addressed, the commercialization is very successful, and it has indeed brought great convenience to developers.

Here’s a summary of Docker.

moby, Docker-ce, and Docker-ee: The Differences

moby is the successor to the original Docker project, a community-maintained open-source project that anyone can build their own container products upon.

Docker-ce is an open-source project maintained by Docker Inc., a free container product based on the moby project.

Docker-ee is a closed-source product maintained by Docker Inc., their commercial offering.

So, in most cases, we use the Docker-ce edition.

Docker-ce Versions

Edge: Monthly release, following the YY.MM naming format, maintained until the next monthly release. Stable: Quarterly release, following the YY.MM naming format, maintained for 4 months.

Installing Docker-ce

Uninstall Old Docker (Optional)

If you have an older version of Docker, you can uninstall it before installation.

Upgrade is not covered here. Please refer to relevant official documentation if needed.

Add the Official Yum Repository

sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

If you get “yum-config-manager: command not found”, install the following yum utility:

Terminal window
yum -y install yum-utils

Install Docker-ce

yum -y install docker-ce

Starting Docker-ce Service

service docker start

Uninstalling Docker-ce

yum remove docker-ce
rm -rf /var/lib/docker

Verifying Docker-ce

docker run hello-world

Docker Compose

Compose is a tool for defining and running multi-container Docker applications.

Docker uses YAML files to configure application services.

Then, with a single command, you can create and start all services from the configuration.

So here we use Docker Compose to manage Docker.

Docker Compose Official Site

Installing Docker Compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Tip: The number after “download” in the link above is the version number. You can check the latest version on the Compose release page and replace it to install the latest Compose.

Add Execute Permission

sudo chmod +x /usr/local/bin/docker-compose

Check Version

docker-compose --version

Basic Usage

# Build and run
docker-compose up
# Build and run your services in the background
docker-compose up -d
# Show services
docker-compose ps
# Stop your services
docker-compose stop

Tips: All commands above should be run in the directory containing your docker-compose.yml file.

More About Docker Applications

Docker — From Beginner to Practice