Skip to content

nfabredev/codecrafters-docker-challenge-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a starting point for Go solutions to the "Build Your Own Docker" Challenge.

In this challenge, you'll build a program that can pull an image from Docker Hub and execute commands in it. Along the way, we'll learn about chroot, kernel namespaces, the docker registry API and much more.

Note: If you're viewing this repo on GitHub, head over to codecrafters.io to signup for early access.

Usage

  1. Ensure you have go installed locally
  2. Download docker-explorer, as mentioned here.
  3. Follow the details below ("Running your program locally") to run your Docker implementation, which is implemented in app/main.go.
  4. Commit your changes and run git push origin master to submit your solution to CodeCrafters. Test output will be streamed to your terminal.

Running your program locally

Since you'll need to use linux-specific syscalls in this challenge, we'll run your code inside a docker container.

docker build -t my_docker .
docker run --cap-add="SYS_ADMIN" my_docker run some_image /usr/local/bin/docker-explorer echo hey

(remember to re-run docker build each time you make changes to your code!)

Passing the first stage

CodeCrafters runs tests when you do a git push. Make an empty commit and push your solution to see the first stage fail.

git commit --allow-empty -m "Running tests"
git push origin master

Go to app/main.go and uncomment the implementation. Commit and push your changes to pass the first stage:

git add .
git commit -m "pass the first stage"
git push origin master

Time to move on to the next stage!

About

Solution for the Codecrafters docker challenge in GO

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published