<!DOCTYPE html>
<html>
<head>
<style>
.Class1 {
position:relative;
display: inline-block;
width: 48%;
margin: 3px;
border: 3px solid #CCC;
}
.Class2 {
position:absolute;
bottom:0;
right:0;
border: 1px solid #CCC;
margin:1px;
background: #FFC;
}
.Fields {
clear: both;
border: 1px solid #CCC;
display: inline-block;
margin:3px;
}
.H_p {
border: 1px solid #CCC;
display: inline-block;
}
.Opt {
border: 1px solid #CCC;
display: none;
}
</style>
</head>
<body>
<h2>My test</h2>
<?php
$Divs = array('Div1'=>'Class1',
'Div2'=>'Class1',
'Div3'=>'Class1',
'Div4'=>'Class1',
'Div5'=>'Class1');
$AskToShow=array("Field1"=>"1.1.1", "Field2"=>"1.2.1", "Field3"=>"1.3.1");
foreach ($Divs as $Name=>$Class){
echo '
<div class="'.$Class.'">';
echo $Name.'<br/>';
foreach ($AskToShow as $I_Name=>$Id){
echo '
<label>'.$I_Name.'</label>
<input type="text" id="'.$Id.'" class="Fields"/>';
}
echo '
<p id="Btn_Opt'.$Name.'" class="Class2" >Mostra campi opzionali</p>';
echo '
<div id=Opt'.$Name.' name="Opt'.$Name.'" class="Opt" >';
foreach ($AskToShow as $H_Name=>$Id){
echo'
<p id="H_'.$Id.'" class="H_p">'.$H_Name.'</p>';
}
echo '
</div>';
echo '
</div>';
}
?>
<script>
var MyClass = document.getElementsByClassName("Class2");
var myFunction = function() {
var SenderId = this.id;
var SubId = SenderId.substring(SenderId.indexOf('_')+1)
var SubSH = document.getElementById(SubId);
if (SubSH.style.display == 'none'){
SubSH.style.display = 'inline-block';
}else{
SubSH.style.display = 'none';
}
};
for (var i = 0; i < MyClass.length; i++) {
MyClass[i].addEventListener('click', myFunction, false);
}
</script>
</body>
</html>
我无法在docker上运行我的脚本,因为我无法运行#!/usr/bin/env python
from time import sleep
import datetime
import os
import shutil
import cv2
import io
import numpy as np
import glob
from threading import Thread
import urllib2
import requests
import json
import boto3
import datetime
,cv2
,numpy
和requests
等模块。当我在终端上运行它时,它工作得很好,但是当我将它作为docker image运行时,它显示错误,没有任何模块命名...如何让它在我的docker上运行?
Dockerfile:
boto3
答案 0 :(得分:5)
您可以运行容器:
docker run -it <image_name>
并在python控制台中执行以下命令,该命令将在容器中安装指定的包:
import os
os.system("pip install --upgrade pip")
os.system("pip install numpy requests boto3 opencv-python")
你会看到:
Collecting numpy
Downloading numpy-1.13.3-cp36-cp36m-manylinux1_x86_64.whl (17.0MB)
100% |████████████████████████████████| 17.0MB 124kB/s
Collecting requests
Downloading requests-2.18.4-py2.py3-none-any.whl (88kB)
100% |████████████████████████████████| 92kB 4.8MB/s
Collecting boto3
Downloading boto3-1.4.7-py2.py3-none-any.whl (128kB)
100% |████████████████████████████████| 133kB 3.4MB/s
Collecting opencv-python
Downloading opencv_python-3.3.0.10-cp36-cp36m-manylinux1_x86_64.whl (15.4MB)
100% |████████████████████████████████| 15.5MB 126kB/s
Collecting certifi>=2017.4.17 (from requests)
Downloading certifi-2017.11.5-py2.py3-none-any.whl (330kB)
100% |████████████████████████████████| 337kB 2.9MB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests)
Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
100% |████████████████████████████████| 143kB 4.4MB/s
Collecting idna<2.7,>=2.5 (from requests)
Downloading idna-2.6-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 6.0MB/s
Collecting urllib3<1.23,>=1.21.1 (from requests)
Downloading urllib3-1.22-py2.py3-none-any.whl (132kB)
100% |████████████████████████████████| 133kB 3.4MB/s
Collecting jmespath<1.0.0,>=0.7.1 (from boto3)
Downloading jmespath-0.9.3-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3)
Downloading s3transfer-0.1.11-py2.py3-none-any.whl (54kB)
100% |████████████████████████████████| 61kB 6.4MB/s
Collecting botocore<1.8.0,>=1.7.0 (from boto3)
Downloading botocore-1.7.46-py2.py3-none-any.whl (3.7MB)
100% |████████████████████████████████| 3.7MB 535kB/s
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.8.0,>=1.7.0->boto3)
Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
100% |████████████████████████████████| 194kB 3.1MB/s
Collecting docutils>=0.10 (from botocore<1.8.0,>=1.7.0->boto3)
Downloading docutils-0.14-py3-none-any.whl (543kB)
100% |████████████████████████████████| 552kB 2.2MB/s
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.8.0,>=1.7.0->boto3)
Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: numpy, certifi, chardet, idna, urllib3, requests, jmespath, six, python-dateutil, docutils, botocore, s3transfer, boto3, opencv-python
Successfully installed boto3-1.4.7 botocore-1.7.46 certifi-2017.11.5 chardet-3.0.4 docutils-0.14 idna-2.6 jmespath-0.9.3 numpy-1.13.3 opencv-python-3.3.0.10 python-dateutil-2.6.1 requests-2.18.4 s3transfer-0.1.11 six-1.11.0 urllib3-1.22
所以一切都好。我在使用FROM python:latest
Dockerfile构建的容器中测试了它。