Skip to content

Instantly share code, notes, and snippets.

@joshuaaguilar20
Created January 28, 2019 23:22
Show Gist options
  • Save joshuaaguilar20/fd356e323cd25e83c6d4c9c8474378ee to your computer and use it in GitHub Desktop.
Save joshuaaguilar20/fd356e323cd25e83c6d4c9c8474378ee to your computer and use it in GitHub Desktop.
DockerBuildRunImage
Building and Running Docker Images
Needs Base Image
Dependencies
Start-Up Command
Touch Dockerfile (no file ext)
inside of file with no ext. define system and variables
# use an existing Image as base
FROM alpine
# download and install dep
RUN apk add --update redis
#the the image what to do
CMD ["redis-server"]
Then Go to Terminal and run docker build . (. meaning all files in folder)
Will output ID of Build
Then Docker Run (ID)
instead of using ID everytime you can use convention to make custom file name
-t yourDockerID/RepoName:version
ex. joshuaaguilar20/DockerClass:1.0 . (last dot for all files)
//builds repo
sudo docker build -t joshuaaguilar20/redisrepo:1.0 .
//runs repo
sudo docker run joshuaaguilar20/redisrepo:1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment