Install Docker from commandline

Install Docker from commandline

you can install Docker from the command line on most systems. Docker provides convenience scripts that can be used to install Docker on macOS and Windows, but on other systems, you can install Docker using your system's package manager.

To install Docker on a system that uses the Debian or Ubuntu distribution of Linux, you can use the following command:


sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io         

On a system that uses the Fedora distribution of Linux, you can use the following command:



sudo dnf install docker         

On a system that uses the CentOS or Red Hat Enterprise Linux distribution of Linux, you can use the following command:



sudo yum install docker         

Once Docker is installed, you can use the docker command to manage Docker containers.

Note: These instructions are for installing Docker on a single system. If you want to install Docker on multiple systems or in a production environment, you should consider using Docker's official installation scripts or Docker's enterprise edition.

After installing Docker, you may want to configure the Docker daemon to start automatically when the system starts. On systems that use the Systemd init system, you can use the following command to enable the Docker service:


sudo systemctl enable docker         

On systems that use the Upstart init system, you can use the following command to enable the Docker service:


sudo chkconfig docker on         

Once the Docker service is enabled, you can start it using the following command:


sudo service docker start         

You can also use the docker command to start and stop the Docker daemon. For example, the following command will stop the Docker daemon:


sudo docker stop         

After starting the Docker daemon, you can use the docker command to manage Docker containers. For example, you can use the docker run command to run a Docker container from a Docker image.


docker run -it ubuntu:18.04 bash         

This command will run an interactive bash shell inside a container based on the ubuntu:18.04 Docker image.

I hope this helps! Let me know if you have any other questions.

To run a Docker container in the background, you can use the -d flag. For example:


docker run -d ubuntu:18.04 sleep 1000         

This command will run a container based on the ubuntu:18.04 image and execute the sleep 1000 command inside the container. The -d flag will run the container in the background, so you will be returned to the command prompt after the container is started.

To view a list of running containers, you can use the docker ps command. This command will list the containers that are currently running on the system.


docker ps         

To view a list of all containers, including stopped containers, you can use the -a flag.


docker ps -a         

To stop a running container, you can use the docker stop command followed by the container ID or name. For example:


docker stop my-container         

This command will stop the container with the name my-container.

I hope this helps! Let me know if you have any other questions.

要查看或添加评论,请登录

Muhammad iqbal的更多文章

  • AI: Karachi - AI Meetup DeepLearning.AI

    AI: Karachi - AI Meetup DeepLearning.AI

    Pie & AI is a series of DeepLearning.AI #Meetups independently hosted by community groups.

  • How to add comments in python

    How to add comments in python

    In Python, comments are used to provide explanations and notes about the code. Comments are ignored by the interpreter…

  • help() function in Python is used to display the documentation

    help() function in Python is used to display the documentation

    The help() function in Python is used to display the documentation or information about a specific module, function…

  • Python version check

    Python version check

    To check which version of Python is currently installed on your system, you can use the following command in the…

  • Introduction to Python

    Introduction to Python

    Python is a high-level, interpreted programming language that is widely used for web development, scientific computing,…

  • how to create a dictionary in python ?

    how to create a dictionary in python ?

    In Python, a dictionary is a collection of key-value pairs. You can create a dictionary using the dict function, or by…

  • what is the difference between a list and a tuple in python ?

    what is the difference between a list and a tuple in python ?

    In Python, a list is an ordered collection of objects that can be of any data type, including other lists. Lists are…

  • define a decorator in python ?

    define a decorator in python ?

    In Python, a decorator is a design pattern that allows you to extend or modify the functionality of a class or function…

  • life cycle of containerised applications

    life cycle of containerised applications

    The life cycle of a containerised application generally consists of the following steps: Development: In this phase…

  • props in React

    props in React

    Here are some key points about props in React: Props (short for "properties") are a way to pass data from a parent…

社区洞察

其他会员也浏览了