Docker Container
Run docker container
Docker containers are lightweight, standalone, executable packages that include everything needed to run a piece of software, including the code, a runtime, libraries, environment variables, and system tools. Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.
Downloading Images from Docker Hub
To download images from Docker Hub, use the docker pull command followed by the name of the image. For common images like Ubuntu, MySQL, or Nginx, the command structure is as follows:
For Ubuntu: docker pull ubuntu
For MySQL: docker pull mysql
For nginx: docker pull nginx
Make sure Docker is installed and running on your system before executing these commands. This will fetch the latest version of the specified image from Docker Hub to your local machine.
Here example I am pulling Ubuntu

Check Docker Images
docker images

To run a Docker container, use the following command:
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
- Replace `IMAGE` with the name of the Docker image you want to run.
- `OPTIONS` can be used to customize the behavior of the command (e.g., `-d` to run the container in detached mode).
- `COMMAND` and `ARG` can be specified to run a specific command inside the container.

docker run -d ubuntu


docker ps -a

docker diff container_name/container_id

docker inspect container_name/container_id

docker starts container_name/container_id

Last updated