How to edit my JS files inside the Docker container using Sublime 3?

2

I'm using Docker 1.7 on MAC OSX and created a container with an Apache and a WEB application.

I would like to edit JS fonts using Sublime Text 3.

How can I do this?

    
asked by anonymous 18.07.2015 / 00:55

2 answers

3

You can use the VOLUME feature to do this.

Suppose your Dockerfile directory is in ~/Desktop/meu-site and the Site Root in Apache (Container) is in /var/www/html

Do the following:

mkdir src
# copie o código de seu site para este diretório src
docker run -d -v ~/Desktop/meu-site/src:/var/www/html

Now do:

subl -a src

Change any file via Sublime Text and reload the WEB page.

Ready! You'll see your change

    
18.07.2015 / 01:02
0

Volume mapping is the most appropriate way to do this.

First check which location your container uses to read the codes you want to handle. Let's imagine that it is /var/www/ .

If your code is in the /home/usuario/codigo folder, the docker command to do the mapping is as follows:

# docker -d -v /home/usuario/codigo:/var/www nome_da_imagem

With this, everything that is added and / or modified in the /home/usuario/codigo folder of the host docker will automatically be modified in the /var/www folder inside the container.

  

Note, some specific services require the service to be restarted in case of a change in the code, in which case, simply drop the container and start again.

For more information about volume mapping: link

    
04.10.2015 / 03:43