GithubHelp home page GithubHelp logo

containers's Introduction

containers

Everything one could wish to know about containers

Docker 101

Contents

  • Networks

  • Port Mappings

  • Exec'ing Into Containers

  • Volumes

  • Image Building

  • CMD v. ENTRYPOINT

SPecifying container Network

docker build -t server . && docker run --rm --network host server

curl as normal

curl localhost:8000/

Exec'ing Inside a Container

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
13de88e52858        server              "./app"             6 seconds ago       Up 4 seconds                            vigilant_cray
$ docker exec -it 13de88e52858 bash
root@N501VW:/app# ls
app  file.log  go.mod  main.go
root@N501VW:/app# cat file.log

Port Mapping

$ docker build -t server . && docker run --rm -p 3000:8000 server
$ curl localhost:3000/

Mapping multiple ports and using UDP

$ docker build -t server . && docker run --rm -p 3000:8000 -p 8000:9000/udp server
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                            NAMES
5c4386fe21ce        server              "./app"             4 seconds ago       Up 3 seconds        0.0.0.0:3000->8000/tcp, 0.0.0.0:8000->9000/udp   infallible_mayer

Volumes

$ docker build -t server . && docker run --rm -it -v ${PWD}:/app -p 8000:8000 server

containers's People

Contributors

alejandrox1 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.