Skip to content

Instantly share code, notes, and snippets.

@t27
Created February 3, 2018 20:07
Show Gist options
  • Save t27/4b2808a821cdf5da1afed9386139f412 to your computer and use it in GitHub Desktop.
Save t27/4b2808a821cdf5da1afed9386139f412 to your computer and use it in GitHub Desktop.
Virtual Linux docker for compiling apps etc.
# run this command to create the docker container
docker run \
--name ubuntuDev \ #containername
-e HOST_IP=$(ifconfig en0 | awk '/ *inet /{print $2}') \ #map the system and container Its, helpful for dev
-v ~/Code:/Code \ #mount the local directory on the container
-t -i \
ubuntu:14.04 /bin/bash
# This created a container called ubuntuDev using the 'ubuntu:14.04' image from docker hub and runs bash interactively.
# -e ensures your networks are mapped correctly
# Also '-v' ensures that your local directory at ~/Code is mounted as /Code within the container,
# so you can actually write code in your OS and compile within docker.
# Now, once you exit the bash session that was created, to resume and reload the same container, do this
docker exec \
-e HOST_IP=$(ifconfig en0 | awk '/ *inet /{print $2}') \
-t -i \
ubuntuDev /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment