Docker is a set of platform as a service products that uses OS-level virtualization to deliver software in packages called containers.


In most cases, you can use a shell provided by docker official to install docker on your server.

wget -qO- | bash

Then, you should open it and ensure the docker will be launched after login.

# for Debian & Ubuntu
systemctl start docker

# for CentOS
service docker start && systemctl enable docker.service

Image Update

To update your image you should pull the latest image from Docker Hub, destory the running container and recreate it with the new image. The data may be lost if you have not persisted them on your disk.


docker stop <YOUR CONTAINER NAME> && docker rm <YOUR CONTAINER NAME>

docker run ...


If you want to build Dockerfile by yourself and push your image to Docker Hub, I highly recommend you develop in local and push them by Github Actions which is a solution for CD/CI proposed by Github.

Building Dockerfile in local

Go to your project directory which has a file named Dockerfile first. Then you should build them.

docker build -t <YOUR DOCKER IMAGE NAME> .

You can run them in your local machine after the build process completed by docker run command like you run a docker image as usual.

Building Dockerfile with Github Actions

For more details about Github Actions, please refer to documentation of Github Actions for developer.

Each time you pushing to Github will trigger this action to build Docker image by Dockerfile in the root of project and push it to Docker Hub with latest tag. If you push to Github with a specific tag, pushing to Docker Hub will have the same tag as well.

name: Publish Docker
on: push
    runs-on: ubuntu-latest
      - uses: actions/[email protected]
      - name: Publish to Registry
        uses: elgohr/[email protected]
          name: <YOUR USERNAME>/<YOUR REPO NAME>
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
          tag_names: true


For more details, you can see this post.

Remove all unused objects involving containers, images and networks.

docker system prune

In additional to remove all objects, you can append --volumes to the command to remove unused volumes.

docker system prune --volumes