#docker (2019-10)

docker

All things docker Archive: https://archive.sweetops.com/docker/

2019-10-28

2019-10-26

2019-10-25

Mithra avatar
Mithra

Hello How to pass ENV file in docker ?

roth.andy avatar
roth.andy
docker run -it --rm -e SOME_ENV=foo ubuntu:latest bash

\# echo $SOME_ENV
foo
ruan.arcega avatar
ruan.arcega

in dockerfile you can specify the ENV settings example:

from ubuntu

ENV TEST=123

...

this settings will export the TEST environment variable in your cointainer

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Or just use the env file argument

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
ruan.arcega avatar
ruan.arcega

good point

jaydip189 avatar
jaydip189

how to pass multiple environment variables and multiple values in dockerfile

roth.andy avatar
roth.andy

RTFM

roth.andy avatar
roth.andy
| Docker Documentation

Dockerfile reference Docker can build images automatically by reading the instructions from a Dockerfile. A Dockerfile is a text document that contains all the commands a user could call on…

2019-10-23

tamsky avatar
tamsky

Docker Desktop now allows users to access the [OSX] host’s SSH agent inside containers. Fixes docker/for-mac#410

Docker Desktop for Mac Edge release notes

This page contains information about Docker Desktop Edge releases. Edge releases give you early access to our newest features. Note that some of the features may be experimental, and some…

:100:1
joshmyers avatar
joshmyers

Holy crap! Amazing!

Docker Desktop for Mac Edge release notes

This page contains information about Docker Desktop Edge releases. Edge releases give you early access to our newest features. Note that some of the features may be experimental, and some…

tamsky avatar
tamsky

@Erik Osterman (Cloud Posse) https://github.com/cloudposse/geodesic/pull/534 to support this.

Not sure of all the edge cases on this, but maybe you can guide me?

add Darwin support for bind mount of ssh-agent socket by tamsky · Pull Request #534 · cloudposse/geodesic

Newly available on Docker for Mac (Edge) release. https://docs.docker.com/docker-for-mac/edge-release-notes/ Someone should test that this doesn’t break on non-Edge Docker-for-Mac releases.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Looks good to me

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

I will check for edge cases

tamsky avatar
tamsky

I’m wondering how it behaves on non-Edge D4M releases

2019-10-22

Matt Gowie avatar
Matt Gowie

Hey folks — I have a Docker container running in EBS. It starts up fine, but then immediately exits. This happens locally too, but if I make the docker container run in interactive by passing -it then it stays up until I make any keypress on my terminal window. I don’t believe I can pass -it to EBS (or even if I could that I would want to). But what do I need to do to keep that Docker container running since it’s starting up without errors? It’s a Java Jetty Server and I am invoking the java process via a script — i.e. my ENTRYPOINT is ./start-backend.sh.

What am I missing?

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

if the process inside a docker container exits for any reason, the container exits

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

your server prob is incorrectly configured so it does not listen on a port, or it throws an error and exists

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

if the server is configured correctly and it listens on a port, then when you start the container locally and do port binding, you’d be able to access the web server in a browser on the local computer

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

without -it

Matt Gowie avatar
Matt Gowie

Huh — The server does bind to a port. If I startup locally without -it it does the following:

Oct-21-2019 4:21:21.558 PM EDT [main] INFO  JettyServer:185 [] Starting server on 0.0.0.0:8080...
Oct-21-2019 4:21:21.878 PM EDT [main] INFO  JettyServer:190 [] Server started.
Oct-21-2019 4:21:21.949 PM EDT [Thread-9] INFO  JettyServer:202 [] Stopping server...
Oct-21-2019 4:21:21.986 PM EDT [Thread-9] INFO  App:94 [] Shutting down...
Oct-21-2019 4:21:22.576 PM EDT [Thread-9] DEBUG App:135 [] Shutdown complete.

With -it the Jetty Server continues to run and I can hit 8080 via my browser.

Matt Gowie avatar
Matt Gowie

Didn’t find this before, but it seems some folks add && tail -f /dev/null to their entrypoint or server startup process to keep it running. That sucks though as now the container isn’t monitoring the actual server process.

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

something is wrong with the server config, it should not start and then stop right away

Matt Gowie avatar
Matt Gowie

@Andriy Knysh (Cloud Posse) Hm, gotcha. I will try figuring that out.

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

(check if the port is not taken by other processes)

Matt Gowie avatar
Matt Gowie

Will do. Thanks for the quick info @Andriy Knysh (Cloud Posse)

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

also looks like the server is starting on the main thread, but stopped on another thread. Could be something about maven/jetty config to wait for the forked child process https://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html

2019-10-17

2019-10-16

Mithra avatar
Mithra

For now I want to set up the Environment variables (Dev, Stage or Test and Production) in a single docker file instead of creating env variables for each environment. All I need is to get those environment variables in a single docker file and deploy through web application in azure portal. Please help me up on it.

Mithra avatar
Mithra

So that the variables has to pick up Dynamically.

2019-10-15

imiltchman avatar
imiltchman
Docker System Status

Our system status page is a real-time view of the performance and uptime of Docker products and services.

imiltchman avatar
imiltchman

Brought down our whole CI/CD in CircleCI. Looks like there is no out-of-the-box redundancy for when the hub is down.

Mithra avatar
Mithra

Hello can some one help me to Create a docker file with environment variables such as (production, QA ) in JSON.

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

what do you mean by in JSON?

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)
Environment variables in Compose

There are multiple parts of Compose that deal with environment variables in one sense or another. This page should help you find the information you need. Substitute environment variables in…

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

you can provide a file with ENV vars

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)
docker run -i --rm --env-file example.env
Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

but those are key-value pairs

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

you can stringify a JSON object into a string, and then provide it as value to an ENV var

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

and then in the app, decode the JSON string into a JSON object

Mithra avatar
Mithra

Thanks

tolstikov avatar
tolstikov

you can also use tools like jq, gomplate to extract some data from JSON in any format you need

2019-10-01

imiltchman avatar
imiltchman

@Nikola Velkovski Thanks for that. What puzzles me is that the container works on other hosts. At which point do permissions of the user within the container get constrained by the host permissions?

imiltchman avatar
imiltchman

When I -it into it as root as su as node, everything works fine

imiltchman avatar
imiltchman

node user has permissions and can run entrypoint and cmd

Nikola Velkovski avatar
Nikola Velkovski

@imiltchman that is weird indeed, I am usually using debian and alpine, and I haven’t encountered similar issues.

Nikola Velkovski avatar
Nikola Velkovski

The only thing I can think of is a MAC software

Nikola Velkovski avatar
Nikola Velkovski

apparmor, SElinux or grsecurity

Nikola Velkovski avatar
Nikola Velkovski

on the host that runs the dockers

imiltchman avatar
imiltchman

disabled everything selinux, but maybe one of the others

imiltchman avatar
imiltchman

It’s a hardened host

Nikola Velkovski avatar
Nikola Velkovski

but wait there was one aditional step…

imiltchman avatar
imiltchman

And I have no visibility atm on how it was setup

Nikola Velkovski avatar
Nikola Velkovski

you need to disable it

Nikola Velkovski avatar
Nikola Velkovski

and then either reboot or restart the service..

Nikola Velkovski avatar
Nikola Velkovski

what was it..

Nikola Velkovski avatar
Nikola Velkovski

<thinking>

imiltchman avatar
imiltchman

Yup, done that, thanks for your input on this

imiltchman avatar
imiltchman

Just annoying that there is nothing but a single exec user process caused "permission denied" error

imiltchman avatar
imiltchman

I thought the purpose of docker was to avoid this kind of nonsense

Nikola Velkovski avatar
Nikola Velkovski

haha you wish

Nikola Velkovski avatar
Nikola Velkovski

it should be the other way around, SElinux is in place just to annoy the hell out of you

    keyboard_arrow_up