-
docker image - is a standalone, executable file used to create a docker container
# Creates an image $ docker build -t <app-name> .
-
docker container - a lightweight, standalone, executable software package that includes everything needed to run a piece of software
# Starts the container $ docker run -dp 5010:5010 my-flask-app # docker compose alternative $ docker-compose up -d
-
Cloud Container Registry container registry - a repository—or collection of repositories—used to store and access container images.
-
Running docker container
$ docker run -it --memory=1g --memory-swap=1g --memory-swappiness=0 --cpus=4 --entrypoint=/bin/bash debugsession $ docker run -it --privileged --name mockserver mockserver /bin/sh
-
Sign into docker
$ docker login -u YOUR-USER-NAME
-
Push your image
$ docker push <namespace>/<image>:<tag>
-
Pull your image
$ docker pull <namespace>/<image>:<tag>
-
Creating networks
$ docker network create my-network
-
Copy the contents of this docker and save it onto your local machine
# Filename: server.dockerfile # Use the Docker-in-Docker image as the base image FROM docker:20.10-dind # Install any additional tools you might need in the remote server container # For example, you can install utilities such as curl, wget, etc. RUN apk update && apk add --no-cache curl wget # Create working directory and copy files needed for your server WORKDIR /app COPY ./app . # Entry point to start the Docker daemon # The Docker daemon will run as the primary process in the container CMD ["dockerd-entrypoint.sh"]
-
Execute the following commands in the terminal where your docker file is located.
# Build docker image $ docker build -t mock-server -f server.dockerfile . # Run your container $ docker run --privileged --name testing -d mock-server # Remote into your outer docker container $ docker exec -it testing sh # Test your inner docker API is working with a CURL command $ curl -X GET http://127.0.0.1:5010/health
- Docker Image - a snapshot or blueprint of the libraries and dependencies required inside a container for an application to run. These images are read-only for the purpose of creating Docker Containers
- Docker Container - a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another