私信  •  关注

Ijaz Ahmad Khan

Ijaz Ahmad Khan 最近回复了
5 年前
回复了 Ijaz Ahmad Khan 创建的主题 » Docker修剪过去X小时内未使用的容器

最好的方法是使用容器编排器/调度器,而不是手动执行类似的操作。例如,可以使用kubernetes cron jobs。

https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/

5 年前
回复了 Ijaz Ahmad Khan 创建的主题 » python中的fcfs调度算法
bt=[]
print("Enter the number of process: ")
n=int(input())
print("Enter the burst time of the processes: \n")
bt=list(map(int, raw_input().split()))

wt=[]
avgwt=0
tat=[]
avgtat=0

wt.insert(0,0)
tat.insert(0,bt[0])

for i in range(1,len(bt)):
   wt.insert(i,wt[i-1]+bt[i-1])
   tat.insert(i,wt[i]+bt[i])
   avgwt+=wt[i]
   avgtat+=tat[i]

avgwt=float(avgwt)/n
avgtat=float(avgtat)/n
print("\n")
print("Process\t  Burst Time\t  Waiting Time\t  Turn Around Time")

for i in range(0,n):
   print(str(i)+"\t\t"+str(bt[i])+"\t\t"+str(wt[i])+"\t\t"+str(tat[i]))
   print("\n")

print("Average Waiting time is: "+str(avgwt))
print("Average Turn Arount Time is: "+str(avgtat))

运行: enter image description here

也许你需要修复你的dockerfile,并注意docker指令的顺序和一些最佳实践。

FROM openjdk:11-jre-slim
WORKDIR /dist
COPY dist/* .
EXPOSE 9000 9443

CMD ["/dist/bin/start","-Dhttps.port=9443"]

首先进行本地测试,通过执行到容器中并执行 ls

5 年前
回复了 Ijaz Ahmad Khan 创建的主题 » 在Docker撰写之后,nginx不运行服务器
  • 您不需要在Docker容器中运行SystemCtl
  • 只是 docker restart <container name> 将执行此操作(如果要重新启动nginx)
  • 你甚至不需要使用docker compose来运行nginx
  • 你可以跑了 docker run --name nginx -v /opt/nginx:/usr/share/nginx/html -p 8080:80 docker.io/nginx

现在卷曲 http://<you machine ip>:8080 应该工作

5 年前
回复了 Ijaz Ahmad Khan 创建的主题 » 包含while循环和异常的python中的字符串

为了检查目的,您可以使用input()方法,然后相应地进行决定。

[iahmad@ijaz001 ~]$ python2.7
Python 2.7.15 (default, May  9 2018, 11:32:33) 
[GCC 7.3.1 20180130 (Red Hat 7.3.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

>>> x=input()
'hi'
>>> type(x)
<type 'str'>

>>> x=input()
10
>>> 
>>> type(x)
<type 'int'>
>>> 

[iahmad@ijaz001 ~]$ python3.6
Python 3.6.5 (default, Apr  4 2018, 15:09:05) 
[GCC 7.3.1 20180130 (Red Hat 7.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> x=eval(input())
'hi'
>>> 
>>> type(x)
<class 'str'>

>>> 
>>> x=eval(input())
10
>>> 
>>> type(x)
<class 'int'> 
5 年前
回复了 Ijaz Ahmad Khan 创建的主题 » 在Python中,确定大于阈值的列表项的最有效方法是什么?

列表理解版本:

sublist = [ i for i in the_list if i > n ]

生成器表达式:(如果列表太大)

sublist = ( i for i in the_list if i > n )
5 年前
回复了 Ijaz Ahmad Khan 创建的主题 » 如何将Docker容器日志大小限制为预定义值

此设置在 /etc/docker/daemon.json 为我的用例工作:

{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "1g"
  }
}