使用Docker & Digital ocean建立开发环境(Cloud IDE)

时间:2022-11-26 23:41:50

I currently develop on OSX and a Chromebook with Ubuntu 14.04 installed. I'm currently using a Cloud IDE (Codio) so that my development environment stays the same on both machines but I feel like I could replicate that using Digital Ocean and Docker.

我目前在OSX上开发和一个安装了Ubuntu 14.04的Chromebook。我现在使用的是一个云IDE(编码),这样我的开发环境在两台机器上都是一样的,但是我觉得我可以使用数字海洋和Docker进行复制。

Essentially, I want to create a couple of base development environments (Rails/Postgres and Node/Express/Angular/Mongo being the two big ones). Every time I start a new project I want to be able to start in a "fresh" environment. Of course, I want all of this to exist on one Digital Ocean droplet.

本质上,我想创建一些基本的开发环境(Rails/Postgres和Node/Express/ angle /Mongo是两个主要的开发环境)。每次我开始一个新项目时,我都希望能够在一个“新鲜”的环境中开始。当然,我希望所有这些都存在于一个数字海洋微粒上。

Is it possible? If so, how would I go about doing it.

是可能的吗?如果是的话,我该怎么做呢?

1 个解决方案

#1


4  

Like I mentioned over on DigitalOcean, this is certainly something that you could do with Docker. If you aren't particularly experienced with Docker, I'd suggest following through their tutorials:

就像我在DigitalOcean中提到的,这当然是Docker可以做的事情。如果你对Docker不是很熟悉,我建议你看看他们的教程:

https://www.docker.io/gettingstarted/

https://www.docker.io/gettingstarted/

After the introduction tutorial, learn about Dockerfiles, they are basically the templates used to create your containers:

在介绍教程之后,了解Dockerfiles,它们基本上是用来创建容器的模板:

https://www.docker.io/learn/dockerfile/

https://www.docker.io/learn/dockerfile/

Just to give you a taste, an extremely basic Dockerfile to install Rails might look like:

让您体验一下,安装Rails的一个非常基本的Dockerfile可能是这样的:

# Set the base image to use to Ubuntu
FROM ubuntu


# Update the repository
RUN apt-get update


# Install stuff
RUN DEBIAN_FRONTEND=noninteractive apt-get -qy install postgresql curl
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq ruby rails

You then build it with:

然后你用:

sudo docker build -t rails - < Dockerfile

#1


4  

Like I mentioned over on DigitalOcean, this is certainly something that you could do with Docker. If you aren't particularly experienced with Docker, I'd suggest following through their tutorials:

就像我在DigitalOcean中提到的,这当然是Docker可以做的事情。如果你对Docker不是很熟悉,我建议你看看他们的教程:

https://www.docker.io/gettingstarted/

https://www.docker.io/gettingstarted/

After the introduction tutorial, learn about Dockerfiles, they are basically the templates used to create your containers:

在介绍教程之后,了解Dockerfiles,它们基本上是用来创建容器的模板:

https://www.docker.io/learn/dockerfile/

https://www.docker.io/learn/dockerfile/

Just to give you a taste, an extremely basic Dockerfile to install Rails might look like:

让您体验一下,安装Rails的一个非常基本的Dockerfile可能是这样的:

# Set the base image to use to Ubuntu
FROM ubuntu


# Update the repository
RUN apt-get update


# Install stuff
RUN DEBIAN_FRONTEND=noninteractive apt-get -qy install postgresql curl
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq ruby rails

You then build it with:

然后你用:

sudo docker build -t rails - < Dockerfile