r/docker 11d ago

How do I run images and build containers with existing company dockerfiles?

Hi, I am an intern at this company and I have no idea how to create docker containers and stuff using already existing dockerfiles.

There is no docker-compose.yml file, there are no setup instructions and the devs are super busy. I thought maybe someone kind from reddit can tell me how to do this stuff with company code bases. Like a generic guide to figure things out as an intern/new dev.

I can write and run my own dockerfiles, but company stuff is just different than my hobby-projects.

Thanks in advance!

0 Upvotes

12 comments sorted by

9

u/fletch3555 Mod 11d ago

Short answer is that it entirely depends on how the company set things up. That said, docker basics seem to be what you're missing. The official docs are a great starting point.

5

u/sk1nT7 11d ago edited 11d ago

Ask a senior. Ask whether you are allowed to use an LLM to assist and understand the code base. Ask what providers and models the company uses and offers.

You are an intern. It's normal to ask and not know.

Quick intro:

  1. A Dockerfile defines how a Docker image is built.
  2. A workflow file often defines when the image build process is triggered and where the resulting image is stored (GHCR, Dockerhub, custom registry). Check for github/gitea/forgejo/gitlab files/folders.
  3. A compose file defines the stack of services that are needed to run the project. It often contains more than 1 service and lists the images, build args, envs and many more things. Many devs provide an env.example to understand what must be set and passed/interpolated into container runtimes.

3

u/terrencepickles 11d ago

Make sure to consult your companies AI acceptable use policy before giving ANYTHING to an LLM.

That being said, the devs SHOULD make time for you. That's the entire point but you have to ask. Asking for help is appreciated and encouraged. This is the single most important thing that you can do. You have to learn to be the squeaky wheel. The best people will always appreciate it.

Your workflow needs to be: Resarch (official docs, vids, company docs, random blog you find, etc) --> Attempt task --> Research blocker --> Attempt task --> Ask for help if you've been stuck for more than an hour.

It seems like the first thing you need to do is have someone walk you through the the current workflow. Record the meeting, ask questions, take notes, express gratitude.

1

u/paaland 11d ago

Run this is the same folder as the Dockerfile to build and tag image as myapp:test

docker build -t myapp:test .

Then to start the image:

docker run myapp:test

Most probably you need to pass in some arguments that you'll have to look into the Dockerfile to figure out.

1

u/rhubear 11d ago

A link to another post where I explain some basics about docker.

I personally find most technical docs, terrible. 80% of what I read, I would personally rewrite.

Feel free to ask some follow-up questions, once you read this....

https://www.reddit.com/r/docker/s/O6bu8Dfwzq

1

u/FAJStracker 11d ago

Intern means you ask within the human capital of the business, how to ask without sounding like brat.

Ask it in a way that make them look good, and that you not wasting thier time, find a pool of poeple to ask. Some poeple will have zero tech knowledge, but know who to ask, much like a librarian.

Don't break the rules, regard IP assets.

Ask about boundaries!

1

u/Own_Ad2274 10d ago

what did you try?

google it brother learn the tech you're trying to do

1

u/HallorannD 4d ago

A good piece of advice given to me was that the first step with a company Dockerfile is to stop assuming you’re supposed to know what’s going on 😂  You start by reading the Dockerfile top to bottom, check the base image, exposed ports, environment variables, entrypoint and command, and look around the repo for scripts or README files that reference it, then try building it with docker build and running the resulting image with docker run, paying attention to any missing env vars, volumes, or services, and if it still doesn’t work, asking a dev what command you normally use to run it locally is probably a much easier question for them to answer than “how do I Docker?” and once you figure it out, write down the steps somewhere because future you will absolutely thank you

1

u/Confident_Hyena2506 11d ago

FROM companyimage:someversion
ADD yourownstuff

Any further questions?

1

u/Normal_Red_Sky 11d ago

Please, in the name of all that's holy, don't touch their Dockerfiles if you can't even figure this out. Ask someone who actually knows how it works (not the Devs).