https://github.com/marshallasch/cdev
A docker image to debug C programs on Mac
https://github.com/marshallasch/cdev
c docker mac
Last synced: 5 months ago
JSON representation
A docker image to debug C programs on Mac
- Host: GitHub
- URL: https://github.com/marshallasch/cdev
- Owner: MarshallAsch
- License: gpl-3.0
- Created: 2019-10-13T15:00:31.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-08-23T04:21:07.000Z (11 months ago)
- Last Synced: 2025-10-09T21:39:02.398Z (9 months ago)
- Topics: c, docker, mac
- Language: Dockerfile
- Size: 34.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README



# C Development
This docker container contains a bunch of the C development tools needed to build a program.
On MacOS 10.14.6 `valgrind` and `gdb` do not work, so I have made this useful docker image where
you can debug a C program from a directory on the host machine.
This container is based on Debian and contains:
- gcc
- g++
- gdb
- make
- valgrind
- git
## Building
To build the container run
```bash
docker build \
--build-arg VCS_REF=$(git rev-parse -q --verify HEAD) \
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
-t cdev .
```
## Usage
```bash
$ docker pull marshallasch/cdev
$ docker run -v :/code -it marshallasch/cdev
```
Where the `` is the directory that contains the code that you wish to test.
The folder will be mounted at `/code`. *NOTE: that any changes made to the files in the docker container
will also be on the host machine.*
## Alias function
Here is a useful little bash function to save time when writing out the long command. You can put this in your `~/.bash_profile`
file.
```
function cDev() {
PASSED=$1
echo ""
if [[ ! -d $PASSED ]]; then
echo "$PASSED must be a directory"
return 1
fi
docker pull marshallasch/cdev
if [[ $? -ne 0 ]]; then
echo "Docker not running.... starting...."
open /Applications/Docker.app
sleep 5
docker pull marshallasch/cdev
fi
echo "starting c dev environment"
docker run -v "$PASSED:/code" -it marshallasch/cdev
}
```