Docker Community Forums

Share and learn in the Docker community.

Any good material to learn compose file and learn how to write the code


I am new to Docker and view some compose file but it is not intuitive for me.
Is there any link that explains the details of compose file so that I can learn and write my
own compose file.

Alex C

The best way to understand docker-compose by following

Also there are courses you can purchase on - Docker Mastery from Bret Fisher

1 Like

The compose file reference guneetbh posted covers everything!

Put the compose files on one screen, open the compose file reference on another screen and go thru the compose file and lookup the meaning of things in the compose file refence. It’s actualy pretty straight forward.

Once you get a brief understanding, try to translate one of your docker run commands with all its parameters in a docker-compose configuration. If you encounter impediments along the line, post your docker run command with all paramenters and the compose file you created so far, and I am sure someone will assist in figuring out what needs to be done differently :slight_smile:

Thank you both for your advise and I will learn to write my own and post any issue in this forum if any question or problem.

Alex C.

To begin, follow the Jetpack Compose setup instructions, and create an app using the Empty Compose Activity template. The default template already contains some Compose elements, but let’s build it up step by step. First, delete the “Greeting” and “Default Preview” functions, and delete the setContent block from MainActivity, leaving the activity blank. Compile and run your blank app.

Now add a text element to your blank activity. You do this by defining a content block, and calling the Text() function.

The setContent block defines the activity’s layout. Instead of defining the layout contents with an XML file, we call composable functions. Jetpack Compose uses a custom Kotlin compiler plugin to transform these composable functions into the app’s UI elements. For example, the Text() function is defined by the Compose UI library; you call that function to declare a text element in your app.

In my experience, the official docs are great when you understand what you’re doing. They can be daunting at first.

I wrote a Docker for Web Developers book and video course because I couldn’t find good novice tutorials which advised how to create local development environments. Use the discount code dock30 for 30% off.