简体   繁体   English

如何在由AWS EC2Instance驱动的Docker运行的jupyter实验室中加载保存的工作?

[英]how to load the saved work in jupyter lab running from docker powered by aws EC2Instance?

I am creating an EC2Instance and pulling some docker files through user-data script to launch jupyter lab for the first time when instance is created , now i save my work in jupyter lab and stop the EC2Instance and when i restart the instance after some time , i again pull the same files this time through rc.local (run on every boot) and it again launches my jupyter lab but i don't have my old saved files , Also i would like to mention that i am attaching EBS Volumes and once i am doing my work the volume size is getting increased , so how can i fix this issue ? 我正在创建一个EC2Instance并通过用户数据脚本提取一些docker文件,以在创建实例时首次启动jupyter lab,现在我将工作保存在jupyter lab中并停止EC2Instance,并且在一段时间后重新启动实例时,这次我再次通过rc.local(在每次启动时运行)提取相同的文件,它再次启动了我的jupyter实验室,但是我没有保存的旧文件,我还要提及我附加了EBS Volumes,我在做我的工作时,卷的大小正在增加,那么如何解决此问题?

Script i am using:- 我正在使用的脚本:-

!/bin/bash !/斌/庆典

sudo yum -y update docker login -u -p docker pull latest/jupyter-env docker run -p 8080:8890 latest/jupyter-env sudo yum -y更新docker登录-u -p docker pull Latest / jupyter-env docker run -p 8080:8890 Latest / jupyter-env

and this same script i have put in rc.local file and then created image of that in the first time so that it triggers automatically on every boot 并且我将相同的脚本放入rc.local文件,然后在第一次创建该文件的映像,以便在每次启动时自动触发

You can mount the host directory of EC2 machine to your docker container and work in that directory when inside jupyter lab. 您可以 EC2计算机的主机目录挂载到docker容器中,并在jupyter实验室中时在该目录中工作。 All the work saved in that directory will remain intact even after you restart your EC2 machine or docker container. 即使重新启动EC2计算机或Docker容器,该目录中保存的所有工作也将保持不变

Command to mount a directory - 挂载目录的命令-

-v ~/ ~/mounted-directory 

Updating your command - 更新命令-

sudo yum -y update docker login -u -p docker pull latest/jupyter-env docker run -p 8080:8890 latest/jupyter-env -v ~/ ~/mounted-directory

For further reference, you can check this link 有关更多参考,您可以检查此链接

yes the answer to the solution was similar as answered above by sat, 是的,解决方案的答案与上述sat的答案相似,

i logged in to my ec2- machine and created a directory test and then i went inside the rc.local file and i write the script there so that i can use this in the restart scenario and then i exit and created an ami out of that ec2-instance, and further use that ami-id and load the user-data script , my changed script which i used in user-data and rc.local file is:- 我登录到ec2-机器并创建了目录测试,然后进入rc.local文件,并在其中编写了脚本,以便可以在重启方案中使用它,然后退出并从中创建了一个ami。 ec2-instance,并进一步使用该ami-id并加载user-data脚本,我在user-data和rc.local文件中使用的更改后的脚本是:

!/bin/bash !/斌/庆典

sudo yum -y update docker login -u -p docker pull latest/jupyter-env docker run -v ~/test/:/home/ -p 8080:8890 latest/jupyter-env sudo yum -y更新docker登录-u -p docker pull Latest / jupyter-env docker run -v〜/ test /:/ home / -p 8080:8890 Latest / jupyter-env

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用java检查EC2实例是否在AWS中运行或停止? - How to check EC2instance is running or stop in AWS using java? 如何通过 AWS EC2 实例在浏览器中运行 Jupyter 实验室? - How to run Jupyter lab in browser through AWS EC2 instance? 如何从本地浏览器访问在 jenkins docker 实例中运行的 AWS EC2 docker tomcat 实例 - How to Access AWS EC2 docker tomcat instance running inside jenkins docker instance from my local browser 如何检测已关闭的 EC2 实例在重新启动时是否具有 AWS 公共池 IP - How to Detect if a Powered Down EC2 Instance will have an AWS Public Pool IP When Powered Back on 无法将 SSH 插入安装了 Jenkins 的 EC2Instance - Not able to SSH into the EC2Instance with Jenkins installed 自动将代码从 Git 实验室部署到 AWS EC2 实例 - Automate code deploy from Git lab to AWS EC2 instance ec2instance 自动化与 python 脚本 - ec2instance automation with python script Aws ec2 - 如何设置负载均衡器以匹配 ec2 实例上的 docker 容器 - Aws ec2 - how to setup load balancer to match docker container on ec2 instance 当容器本身在 AWS EC2 实例中运行时,如何浏览在 docker 容器中运行的网络服务器? - How to browse a webserver running in a docker container when the container itself is running in an AWS EC2 instance? 如何从工作和家庭连接相同的 AWS EC2 实例? - How to connect same AWS EC2 instance from work and home?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM