Docker desktop alternative = minikube
- image: an executable package that includes everything needed to run an application–the code, a runtime, libraries, environment variables, and configuration files
- container: running image instance
- docker-compose.yml: defines how Docker containers should behave in production
terminal
docker ps -a // list all docker containers docker info // show docker info docker image ls --all // list all images docker build -t imagename . // build a docker image docker run -p 4000:80 imagename // run the image on localhost:4000
Dockerfile
# Use an official Python runtime as a parent image FROM python:2.7-slim # Set the working directory to /app WORKDIR /app # Copy the current directory contents into the container at /app COPY . /app # Install any needed packages specified in requirements.txt RUN pip install --trusted-host pypi.python.org -r requirements.txt # Make port 80 available to the world outside this container EXPOSE 80 # Define environment variable ENV NAME World # Run app.py when the container launches CMD ["python", "app.py"]
docker-compose.yml
version: "3" services: web: # replace username/repo:tag with your name and image details image: username/repo:tag deploy: replicas: 5 resources: limits: cpus: "0.1" memory: 50M restart_policy: condition: on-failure ports: - "4000:80" networks: - webnet networks: webnet:
Be First to Comment