Docker helps to deliver software in a container which can be deployed on any OS machine having docker. This removes the dependency on system requirements as those are captured in the container itself.
- Image: This is the output of docker build and has all the information about what all software components goes into the package.
- Container: This is the output of docker run and is built out of image.
docker image build -t imagename .
Dockerfile is needed to build the docker image.
docker search alpine
docker image ls
docker image history image_name
docker image rm image_name
docker container run -itd -p 80:80 --name demo alpine ash
i stands for interactive mode( to have stdin connected to terminal of container)
d for detached mode
t for virtual terminal linked to container
name gives the container name
alpine is the image name
ash is the command run within the container
docker logs container_name
docker container inspect container_name
docker container stop container_name
docker restart container_name
docker container rm container_name
docker container prune
docker container exec -it container_name /bin/bash
docker container ls
docker network create network_name
docker network connect network_name container_name
docker network disconnect network_name container_name
docker network ls
docker network rm network_name
docker network inspect network_name