Running emacs in a docker container

后端 未结 3 1339
余生分开走
余生分开走 2021-02-05 05:23

I\'m using a Mac and want to run emacs in my docker container. Is there a preferred way to solve this? In my flow I get stuc because the DISPLAY/TERM aren\'t set



        
3条回答
  •  逝去的感伤
    2021-02-05 05:50

    Running an editor inside the container isn't really a good idea. Containers work well for services, not interactive applications. If you try it, all the input and output is being multiplexed over an http channel from the process (emacs) to the Docker CLI via the Docker daemon. Also if the files you are editing are within the container's layered filesystem then that adds extra overhead too.

    As Docker say, volumes are a better option:

    you can also mount a directory from your own host into a container.

    $ sudo docker run -d -P --name web -v /src/webapp:/opt/webapp training/webapp python app.py
    

    This will mount the local directory, /src/webapp, into the container as the /opt/webapp directory. This is very useful for testing, for example we can mount our source code inside the container and see our application at work as we change the source code.

    Note that as from Docker 1.3 the -v switch will also work from the outer Mac.

提交回复
热议问题