How to deploy a self-building Docker image to make changes to itself in respect to the local environment?

后端 未结 2 1576
粉色の甜心
粉色の甜心 2021-01-24 16:41

As a quick recap, docker serves as a way to write code or configuration file changes for a specific web service, run environment, virtual machines, all from the cozy confines of

相关标签:
2条回答
  • 2021-01-24 17:11

    Sounds more like a provisioning system a la ansible, chef or puppet to me. I know some use those to create images if you have to stay in the dockerland.

    0 讨论(0)
  • 2021-01-24 17:17

    Docker isn't going to offer you painless builds. Docker doesn't know what you want.

    You have several options here:

    • Kitematic for OSX https://kitematic.com/ (They also have an alpha release for Windows here https://github.com/kitematic/kitematic/releases). You use this application to download containers that others have put the work into in a GUI interface.

    • Docker Compose. Docker Compose lets you use YAML configuration files to boot up docker containers. If you would like to see some examples of this view this repo: https://github.com/b00giZm/docker-compose-nodejs-examples

    A simple example:

    web:
    build: .
    volumes:
       - "app:/src/app"
    ports:
       - "3030:3000"
    

    To use it:

    docker-compose up

    Docker compose will then:

    1. Call the container web
    2. build using the current working directory as root
    3. Mount app directory to /src/app in the container
    4. Expose container port 3030 as 3000 to the outside world.

    Note that build can also point to a Docker container you found via Kitematic (which reads from registry.hub.docker.com) so you can replace the . (in the example above on the build line) with node:latest and it will build a NodeJS container.

    Docker Compose is very similar to the docker command line. You can use https://lorry.io/ for help generating the docker-compose.yml files.

    • If you're looking for an epic solution, then I would recommend something like Mesosphere for an enterprise Docker environment.

    There are other solutions you could also look into like Google's Kubernetes and Apache Mesos, but the learning curve will increase.

    I also noticed you were mucking with IP's and while I haven't used it, from what I hear, Weave greatly simplifies the network aspect of Docker, which is definitely not Docker's strong suit.

    0 讨论(0)
提交回复
热议问题