Tag: docker


Using Emacs to edit files within Docker containers

Using Emacs to edit files within Docker containers

Introduction

This article explores how you can use an Emacs package docker-tramp, which extends the built-in TRAMP mode, to remote into your Docker containers and make changes to files from within Emacs. In a previous article, how to edit files within docker containers, we discussed how you could make changes to files within a running container by opening a shell and using the command line program sed. If you are an Emacs user you will find the method in this article much more convenient than opening a shell within a running...

Continue Reading

How to edit files within docker containers

How to edit files within docker containers

Disclaimer

You have probably heard countless times that you should never edit a docker container's state, or editing container state is an anti-pattern, or if you need to edit a container's state you should use volumes. That advice is good advice and so this article starts with a disclaimer. If you really need to edit file(s) within a docker container you most likely should do it in one of two ways:
  1. Use a docker volume; or
  2. Make any edits to the file(s) part of the image's DOCKERFILE
I would recommend never editing a file in production unless the...

Continue Reading

How to start a shell in a running Docker container

How to start a shell in a running Docker container

Introduction

There are a number of reasons for wanting to open a shell within a running container, including:
  • To see the contents of any number of configuration files.
  • To make a quick change to a file which is not part of any of the container's mounted volumes.
    • It should be noted that this is most likely an anti-pattern. However, it could also be argued that it is harmless if the change is minor and is made only in development environments for debugging and tweaking.
    • If the change you are making is intended to be permanent you should consider capturing it...

      Continue Reading