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.repoIf you get “yum-config-manager: command not found”, install the following yum utility:
yum -y install yum-utilsInstall Docker-ce
yum -y install docker-ceStarting Docker-ce Service
service docker startUninstalling Docker-ce
yum remove docker-cerm -rf /var/lib/dockerVerifying Docker-ce
docker run hello-worldDocker 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.
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-composeTip: 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-composeCheck Version
docker-compose --versionBasic Usage
# Build and rundocker-compose up
# Build and run your services in the backgrounddocker-compose up -d
# Show servicesdocker-compose ps
# Stop your servicesdocker-compose stopTips: All commands above should be run in the directory containing your docker-compose.yml file.