Skip to content

Commit 840f061

Browse files
authored
Merge pull request #64 from ash-olakangal/extend-docker-image
Added tutorial section on extending docker image
2 parents ca9c246 + fbfbf49 commit 840f061

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

images.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ in these docker images.
1919

2020
As the images have no editor installed by default you can create a simple
2121
program using `cat` as below. If needed you can install an editor with `apt-get`
22-
or by extending the docker image.
22+
or [by extending the docker image](#extending-the-docker-image).
2323

2424
Create a `hello.c`
2525

@@ -226,6 +226,40 @@ Hello
226226
src/mor1kx_5.2/bench/verilog/mor1kx_monitor.v:140: $finish called at 171635 (1s)
227227
```
228228

229+
## Extending the docker image
230+
231+
To add vim or other terminal based text editors while running docker you can extend the docker image with the following steps:
232+
233+
1. Create a file named `Dockerfile` where you're planning to run OpenRISC image from (ensure you're not running the docker image):
234+
235+
```bash
236+
touch Dockerfile
237+
```
238+
239+
2. Add the following to the `Dockerfile` and save it:
240+
241+
```bash
242+
FROM stffrdhrn/or1k-sim-env
243+
244+
# Install the terminal-based Vim
245+
RUN apt-get update && apt-get install -y \
246+
vim \
247+
&& rm -rf /var/lib/apt/lists/*
248+
```
249+
250+
3. Build and run:
251+
252+
```bash
253+
docker build -t openrisc-vim .
254+
docker run -it openrisc-vim /bin/bash
255+
```
256+
257+
4. You should now be able to open and edit files using vim every time you run the above command:
258+
259+
```bash
260+
$ vi hello.c
261+
```
262+
229263
## Further Reading
230264

231265
- [stffrdhrn/or1k-docker-images](https://github.com/stffrdhrn/or1k-docker-images) - OpenRISC docker images home page

0 commit comments

Comments
 (0)