Vignan’s University Students: Adding Docker Basics to Your Java Internship Skill Set

Facebook
Twitter
LinkedIn
WhatsApp
Email

Yes, Docker basics are worth adding to a Java internship skill set, and you can learn enough in about a week. For a Spring Boot project, that means writing one Dockerfile, running one database through Docker Compose, and being able to explain what each line does. Stop there; orchestration, Kubernetes and cloud deployment are for later.

This guide is written for students at Vignan’s Foundation for Science, Technology and Research (VFSTR) and for any Java learner on a short internship. It gives you a 14-day plan, a complete working setup (shown as illustrative code), a troubleshooting table, and a clear limit on what to learn.

Why a Spring Boot intern should know Docker basics

Most Java teams do not say “it runs on my laptop” any more. They ship an image, and the same image runs on a colleague’s machine, a test server and production. As an intern you will probably be asked to do one or more of these:

  • Run the team’s service locally without installing a database by hand.
  • Build a project and confirm it starts in a clean environment.
  • Read a Dockerfile or docker-compose.yml already in the repository and change a port or environment variable.
  • Explain in a review how your service connects to its database.

None of this needs deep infrastructure knowledge. It needs a small, accurate mental model and a few commands you have actually typed.

The mental model in five terms

Term Plain meaning Spring Boot example
Image A read-only package containing your app and what it needs to run Your JAR plus a Java runtime
Container A running instance of an image The app listening on port 8080
Dockerfile Recipe for building an image Copy the JAR, set the start command
Volume Storage that outlives a container Database files
Compose file One file describing several containers and how they connect App + PostgreSQL

What you need before starting

  • JDK 17 or newer and Maven or Gradle (the example uses Maven).
  • Docker Desktop (Windows or macOS) or Docker Engine (Linux). On Windows, Docker Desktop normally relies on WSL 2, so enable it first.
  • A small Spring Boot app with Spring Web, Spring Data JPA and the PostgreSQL driver. A simple “students” or “tasks” CRUD API is enough.
  • At least 8 GB of RAM is comfortable; on smaller laptops, close the browser tabs and IDE extras before running containers.

Check the installation with docker --version and docker run hello-world. If the second command prints a welcome message, Docker is working.

Free 2-Week CareerSwami Internship

Online, 14 days, with a free offer letter and a free completion certificate once you finish the work. Check with your college that it fits your requirement before you enrol.

Apply for the free internship

Step 1: Build the JAR and write a Dockerfile

Everything below is illustrative: adapt names and versions to your project. Start by confirming that the app builds normally.

./mvnw clean package -DskipTests

This produces a JAR in target/. Now create a file named Dockerfile (no extension) in the project root. A multi-stage version builds inside Docker, so a teammate does not need Maven installed:

# Stage 1: build
FROM maven:3.9-eclipse-temurin-17 AS build
WORKDIR /app
COPY pom.xml .
RUN mvn -q dependency:go-offline
COPY src ./src
RUN mvn -q clean package -DskipTests

# Stage 2: run
FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","app.jar"]

What each part does

  • Two stages: the first has the full JDK and Maven; the second has only a JRE, so the final image is smaller.
  • Copying pom.xml first: Docker caches layers, so dependencies are only re-downloaded when pom.xml changes. This makes rebuilds much faster.
  • EXPOSE 8080: documentation of the port; it does not publish it. Publishing happens with -p or in Compose.
  • ENTRYPOINT: the command that runs when the container starts.

Add a .dockerignore file so you do not send unnecessary files to the build:

target/
.git/
.idea/
*.iml
.env

Build and run the image (the app will fail to reach a database for now, which is expected if it needs one at startup):

docker build -t student-api:0.1 .
docker run --rm -p 8080:8080 student-api:0.1

Step 2: Add PostgreSQL with Docker Compose

Instead of installing PostgreSQL on your laptop, describe both services in one docker-compose.yml:

services:
  db:
    image: postgres:16
    environment:
      POSTGRES_DB: studentdb
      POSTGRES_USER: student
      POSTGRES_PASSWORD: change_me_locally
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U student -d studentdb"]
      interval: 5s
      timeout: 3s
      retries: 10

  app:
    build: .
    ports:
      - "8080:8080"
    environment:
      SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/studentdb
      SPRING_DATASOURCE_USERNAME: student
      SPRING_DATASOURCE_PASSWORD: change_me_locally
      SPRING_JPA_HIBERNATE_DDL_AUTO: update
    depends_on:
      db:
        condition: service_healthy

volumes:
  pgdata:

The three ideas that matter most

  1. The hostname is the service name. Inside Compose, the app reaches the database at db, not localhost. Inside the app container, localhost means the app container itself.
  2. Spring reads environment variables. SPRING_DATASOURCE_URL overrides spring.datasource.url in application.properties, so one image works in many environments.
  3. Healthcheck plus depends_on. A started database container is not necessarily ready to accept connections. The health condition makes the app wait.

Start everything:

docker compose up --build
# in another terminal
curl http://localhost:8080/actuator/health

The health URL only works if you added Spring Boot Actuator; otherwise call one of your own endpoints. Stop with Ctrl+C, then docker compose down. Add -v only when you want to delete the database volume and start fresh.

Worked example: a task API moving from “works on my machine” to Compose

Illustrative scenario, not a real project or test result. Asha is an intern given a small Spring Boot “tasks” API. It uses PostgreSQL on her laptop and a hard-coded URL, jdbc:postgresql://localhost:5432/tasks. Her mentor asks her to make it start with one command.

  1. Externalise config. She leaves the default in application.properties for local IDE runs but confirms Spring will accept environment variable overrides.
  2. Write the Dockerfile using the multi-stage pattern above and add .dockerignore.
  3. Write Compose with db and app, replacing localhost with db in the app’s environment.
  4. First run fails: the log says Connection refused. She realises a leftover localhost value is still being used, because her environment variable name had a typo. She fixes SPRING_DATASOURCE_URL.
  5. Second run starts, but data vanishes after down -v. That is expected: she deleted the volume. She now uses plain down to keep data.
  6. She documents it: a short README section with the three commands: docker compose up --build, docker compose logs app, docker compose down.

The README step matters as much as the YAML. A mentor reviewing your work will value a teammate being able to run it in two minutes.

Docker troubleshooting table for Spring Boot and Compose

Symptom Likely cause What to try
Connection refused to the database from the app container URL uses localhost, or the database is not ready yet Use the service name db; add the healthcheck and depends_on condition
port is already allocated or bind error on 5432 or 8080 A local PostgreSQL or another app already uses the port Stop the local service, or map to another host port such as "5433:5432"
no main manifest attribute The JAR was not built with the Spring Boot plugin Check that spring-boot-maven-plugin is in pom.xml
Build copies the wrong JAR or fails on *.jar Both a plain JAR and a repackaged JAR exist in target/ Set finalName or copy the exact file name
Password authentication failed The volume was created with an older password; the environment variable only applies on first initialisation Run docker compose down -v to recreate it (this erases local data)
Changes to code do not appear The old image is being reused Run docker compose up --build
Very slow builds Dependencies are re-downloaded on every build Copy pom.xml before src, as shown above; keep .dockerignore correct
Docker Desktop will not start on Windows WSL 2 or virtualisation is disabled Enable WSL 2 and virtualisation in BIOS or Windows features, then restart
Container exits immediately The app crashed at startup Read docker compose logs app from the top for the first exception
Table not found or schema errors No migrations ran, and DDL auto is off Use update locally, or add Flyway migrations for anything shared

Five commands that solve most problems

  • docker ps -a: see which containers are running or have exited.
  • docker compose logs -f app: follow the app logs.
  • docker compose exec db psql -U student -d studentdb: open a database shell and check tables.
  • docker compose config: print the resolved Compose file and catch indentation errors.
  • docker system df: see how much disk space images and volumes use.

A 14-day plan that fits Docker into a two-week internship

Docker should be a supporting skill, not the whole internship. If you take the free two-week online internship from CareerSwami, treat the first days for your main Java deliverable and use short, fixed time blocks for Docker. The plan below assumes about 60 to 90 minutes a day for Docker alongside your main task.

Days Main Java work Docker block
1-2 Set up project, define entities and endpoints Install Docker, run hello-world, run a Postgres container by hand
3-4 Implement CRUD with Spring Data JPA Learn image vs container; read a sample Dockerfile line by line
5-6 Validation, error handling, basic tests Write your own Dockerfile and build the image
7-8 Add one extra feature (search, pagination or auth basics) Write docker-compose.yml with app + database
9-10 Clean up code, add logging Add healthcheck, volume and environment-variable config
11-12 Write README and API examples Practise the troubleshooting table; do a clean rebuild from scratch
13 Final testing Have a friend run your project from the README only
14 Submission and short demo or write-up No new Docker learning; polish only

On completion you can receive a free completion certificate, and the offer letter is free as well. Neither replaces a working, well-documented project, which is what you can actually show.

How much Docker to learn during an internship, and what to leave out

Learn:

  • Writing a Dockerfile for a Spring Boot JAR, including multi-stage builds.
  • Compose with one app and one database.
  • Environment variables, ports, volumes, and reading logs.
  • Explaining image versus container in your own words.

Postpone:

  • Kubernetes, Helm and service meshes.
  • Custom networks, multi-host setups and Docker Swarm.
  • Image security scanning and registry pipelines (know they exist, nothing more).
  • Buildpacks and layered JAR optimisation, unless your mentor asks.
  • Cloud container services.

A useful rule: if a topic does not help someone else run your project tomorrow, it can wait. A clean Compose setup with a clear README is stronger than a half-understood Kubernetes manifest.

Docker skills and the internship setup for Vignan’s (VFSTR) students

VFSTR is a deemed university at Vadlamudi in Guntur district. Its NAAC Self Study Report says it was established in 2008 as a Deemed to be University, and that it lists no affiliated colleges. In practice, this means internship and project rules are set by the university itself rather than by a separate parent university, so the answers you need sit within VFSTR’s own departments.

The same report lists a semester-long industry internship in the final year as part of its academic policy for experiential learning. It gives no credits, evaluation method or regulation year, and the document is dated 2021, so check the current version. It also says courses in areas such as AI, cyber security and IoT have been introduced, which suggests Java-based backend skills can complement coursework, though no syllabus was verified here.

What is not confirmed: how VFSTR treats a short online internship, whether it counts towards any requirement, which documents your department wants, and what a project report must contain. Do not assume a two-week internship substitutes for anything. A Docker-ready Spring Boot project is useful for your portfolio either way, and it takes only a few hours to make it reproducible for a faculty reviewer.

Verification steps for VFSTR students before you rely on this internship

  1. Ask your department office or internship coordinator, in writing, whether a short online internship is recognised for any requirement, and get the answer by email.
  2. Request the current internship or project-work regulation for your batch and note its regulation year, duration, credits and evaluation rules.
  3. Ask what documents are required (offer letter, certificate, report, mentor letter) and in what format.
  4. If a final-year industry internship applies to you, ask the training and placement cell how companies are approved and whether your own project work can be shown in that process.
  5. Ask a faculty mentor whether your lab machines or hostel network allow Docker, since image downloads need a decent connection and admin rights.
  6. Confirm the academic calendar dates so your 14 days do not clash with exams.

Presenting your Docker work on a resume and in interviews

Keep claims precise. “Containerized a Spring Boot REST API with a multi-stage Dockerfile and PostgreSQL via Docker Compose” is accurate and checkable. Avoid wording that suggests production deployment if you only ran locally.

  • Put the Dockerfile and Compose file in the repository root, with the README commands at the top.
  • Never commit real passwords; use a .env file listed in .gitignore and provide a .env.example.
  • Be ready to explain: why two stages, why the hostname is db, what a volume protects, and what happens on down -v.
  • Mention what you deliberately did not do, such as orchestration, and why.

Frequently Asked Questions

Do I need to learn Docker to get a Java internship?

No, it is rarely a requirement for entry-level roles, but it is a useful extra. Core Java, Spring Boot, SQL and Git matter more. Docker basics help you run projects consistently and show practical habits.

Should I use a Dockerfile or Docker Compose for my Spring Boot project?

Use both. The Dockerfile builds your app image; Compose runs the app together with its database and settings. For a single stateless app a Dockerfile alone is enough, but most Spring Boot projects with a database benefit from Compose.

Why does my app say “connection refused” when the database container is running?

Usually the JDBC URL uses localhost, which inside the app container points to itself. Use the Compose service name, such as db. The other common cause is the app starting before the database is ready, which a healthcheck solves.

Will my data survive when I stop the containers?

Yes, if you use a named volume and stop with docker compose down. Data is deleted if you add -v, which removes volumes. Without a volume, data disappears when the container is removed.

Can I run Docker on a low-spec college laptop?

Often yes for one app and one database, but it can be slow. Close heavy applications, avoid running several stacks together, and prune unused images with Docker’s cleanup commands. If Docker Desktop will not run, ask your mentor whether a cloud IDE or a lab machine is available.

Is a two-week internship enough time to learn Docker?

Enough for the basics in this guide, if you limit it to a short daily block. It is not enough for production-level container skills, and you should not claim those on a resume.

Will this internship count for credit at my university?

That cannot be assumed. The CareerSwami internship is free, with a free offer letter and completion certificate, but it does not come with academic credit. Ask your department in writing whether it is recognised for any requirement.

Should I put database passwords in the Compose file?

For a local practice project, a dummy password is acceptable. For anything shared or public, keep secrets in an untracked .env file and commit only an example file with placeholder values.

Related Java & Enterprise Software guides

Ready to put this into practice?

Join the free two-week CareerSwami online internship in Java & Enterprise Software. The internship, the offer letter and the completion certificate are free.

Start your free 2-week internship

Web Stories

Scroll to Top