4

I am using a default MS configuration (in Visual Studio Code -> "Remote-Container: Add Development Container Configuration Files...") and added the following to the

.devcontainer/devcontainer.json
"postCreateCommand": "alias ll='ls -alF'"

Using the command manually in the vscode terminal after creation yields the desired ll.

How do I have to specify the "postCreateCommand"-entry to get the alias?

BadAtLaTeX
  • 614
  • 1
  • 9
  • 22

1 Answers1

6

Correct me if I'm wrong. You want to have the ll alias available inside the container. You can achieve this by adding this line to the Dockerfile:
RUN echo "alias ll='ls -alF'" >> /etc/bash.bashrc

If you want to leave the Dockerfile as is, you can also add it to the postCreateCommand like this: "postCreateCommand": "echo alias ll=\\'ls -alF\\' >> /etc/bash.bashrc" This will add the alias directly to the system-wide bashrc file. The alias will be available in all interactive shells started within the container.

If you run into a "Permission denied" then you can also do this:
"postCreateCommand": "echo alias ll=\\'ls -alF\\' >> /home/vscode/.bashrc" credit to @Damian for this one.

DevShot
  • 276
  • 2
  • 9