Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create a Docker container

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to create a Docker container". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

GIScript2016 is a geospatial data processing and analysis kit that supports Python3, supports Jupyter and Spark, and can run on stand-alone and large-scale clusters. GIScript with Jupyter+Spark on Docker this technology stack is very powerful, through the conda package manager can also install a large number of scientific computing packages, such as NumPy, Scikit, Pandas and OpenCV, NLTK, Tensorflow, Keras and other machine learning software packages, is really big data processing, analysis and in-depth research artifact.

1. Create a Docker container

Push the container image to DockerHub and it can be used in other computers connected to the network.

1.1 submit Container Image

First, submit an image under your DockerHub account (if you don't already have an account, register one on hub.docker.com), and then submit the current image as the version of the account. As follows:

Docker commit GISpark openthings/gispark1.2 push image to the cloud

First, log in to your Docker account as follows:

Docker login

Enter the account number and password registered on DockerHub when prompted.

Start pushing Docker images to DockerHub cloud storage, as shown below.

Docker push openthings/gispark

The above openthings is your registered user name on Dockerhub and needs to be changed to your own. Same as below.

1.3 pull the image to the local machine

Then go to another computer and pull the image down:

Docker pull openthings/gispark2. Run Docker Container 2.1 run GISript Container instance docker run-it-- name GISpark-p 9000 it 8888-- user root-e GRANT_SUDO=yes-v / Local Directory / GISpark:/home/jovyan/work/GISpark openthings/gispark

The local directory is the directory of the host, which is used to store shared data. Enter Docker ps and you can see a list of all the containers currently running.

2.2 close the container instance

Follow the prompts in the console window, press Ctrl+C and select y or press Ctrl+C twice to exit the running state.

2.3 restart the container instance

Use the docker start container ID to start the stopped instance (use docker ps-a to view the list). You can restart a running instance using the docker restart container ID.

2.4 start using

Open the browser, type: http://localhost:9000, and you can see:

3. Run the Python3 routine

Click the "New" button and select "Python3" to create a new Notebook. Then copy the following code into Cell.

Take obtaining file information as an example:

# coding: utf-8import sysfrom GIScript import GISCORED Conversionmakers paths!\ brief file path definition''strTiffPath = "Raster/astronaut (CMYK) _ 32.tif" if _ _ name__ = =' _ _ main__': try: fileParser = Conversion.FileParser () bOpen = fileParser.Open (strTiffPath) If bOpen: rasterInfo = fileParser.GetRasterInfo () nWidth = rasterInfo.GetWidth () nHeight = rasterInfo.GetHeight () pixelFormat = rasterInfo.GetPixelFormat () rc2Bounds = rasterInfo.GetBounds () nBandCount = rasterInfo.GetBandCount () nBlockSize = rasterInfo.GetBlockSize () strPrj = rasterInfo. GetProjection () dXRatio = rc2Bounds.Width () / nWidth dYRatio = rc2Bounds.Height () / nHeight colorset = rasterInfo.GetColorset () dMax = rasterInfo.GetMax () dMin = rasterInfo.GetMin () dNoValue = rasterInfo.GetNoValue () print ("= File basic Information =") print ("Picture width:" NWidth) print ("Picture height:", nHeight) print ("Pixel format:", pixelFormat) print ("Band number:", nBandCount) print ("Block size:", nBlockSize) print ("Block Storage data:", rasterInfo.GetIsTile ()) print ("Bound range (top left, bottom right): (", rc2Bounds.left, " ", rc2Bounds.top,", ", rc2Bounds.right,", ", rc2Bounds.bottom,") print ("X, Y Resolution:", dXRatio, dYRatio) print ("Color Table size:", len (colorset)) print ("maximum:", dMax) print ("minimum:" DMin) print ("No value:", dNoValue) if strPrj! = "": print ("projection:" StrPrj) else: print ("projection: plane coordinate system") print ("=") fileParser.Close () except SystemExit: raise except: sys.stderr.write ("An internal error occured.") Raise

Press Shift+Enter to run the above code.

This is the end of how to create a Docker Container. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report