docker swam code example

Example 1: docker container

docker container ls -a
docker ps -a

docker container stop [ID]

docker container run -d -p 80:80 --name nginx-server nginx

Example 2: docker scikit

# Use an official Python runtime as a parent image
FROM python:3.6-slim

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
ADD . /app

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt

# Define environment variable
ENV NAME World

EXPOSE 5003 

# Run app.py when the container launches
CMD ["python", "app.py"]

# requirements.txt
Flask==1.0
numpy
scipy
scikit-learn
pandas

Tags:

Misc Example